From 743684fe39a56cdc0409ad6877afae486242ec2c Mon Sep 17 00:00:00 2001 From: Edmund Grimley Evans Date: Thu, 15 Oct 2015 19:02:58 +0100 Subject: [PATCH] tccpp.c: Avoid infinite loop on: printf '/**' | ./tcc - --- tccpp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tccpp.c b/tccpp.c index 2936ef7..e8fbd60 100644 --- a/tccpp.c +++ b/tccpp.c @@ -587,6 +587,8 @@ ST_FUNC uint8_t *parse_comment(uint8_t *p) file->buf_ptr = p; c = handle_eob(); p = file->buf_ptr; + if (c == CH_EOF) + tcc_error("unexpected end of file in comment"); if (c == '\\') { /* skip '\[\r]\n', otherwise just skip the stray */ while (c == '\\') {