scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 99bbacfea1e1440120f0bc7579a36c09f16e342a
parent 7a5dbbc2d23f9d545fe95ef336d3ef1e7bf4d831
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 26 Oct 2022 15:20:04 +0200

cc1: Return EOF in skipspace() when no input

If we don't have a input pointer it is clear that we
have to return EOF and in case of not returning the code
just will segfault.

Diffstat:
Msrc/cmd/cc/cc1/lex.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/cmd/cc/cc1/lex.c b/src/cmd/cc/cc1/lex.c @@ -797,6 +797,9 @@ skipspaces(void) { int c; + if (!input) + return EOF; + for (;;) { switch (c = *input->p) { case '\n':