diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-07-31 11:31:04 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-07-31 11:31:04 +0900 |
commit | 1dc443a1a6e28320b9da6a8d5a12715dcc691115 (patch) | |
tree | ca2e67135cf58d8897a2aabe46c9d8ef680973dd | |
parent | 71b1f4d5a5895d5971e1dd01080b75f71043ddee (diff) | |
download | efl-1dc443a1a6e28320b9da6a8d5a12715dcc691115.tar.gz |
epp - cpp - fix buffer end/null checks given static buffer paths
this is an ncient bug that's never been triggered... but it's there.
fix and compare to null buffer.
found by PVS studio
@fix
-rw-r--r-- | src/bin/edje/epp/cpplib.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/edje/epp/cpplib.c b/src/bin/edje/epp/cpplib.c index 0eb25e2b67..2f84c343c3 100644 --- a/src/bin/edje/epp/cpplib.c +++ b/src/bin/edje/epp/cpplib.c @@ -2329,7 +2329,7 @@ special_symbol(HASHNODE * hp, cpp_reader * pfile) if (hp->type == T_BASE_FILE) { - while (CPP_PREV_BUFFER(ip)) + while (CPP_PREV_BUFFER(ip) != CPP_NULL_BUFFER(pfile)) ip = CPP_PREV_BUFFER(ip); } string = ip->nominal_fname; @@ -2343,7 +2343,7 @@ special_symbol(HASHNODE * hp, cpp_reader * pfile) case T_INCLUDE_LEVEL: true_indepth = 0; - for (ip = CPP_BUFFER(pfile); ip; ip = CPP_PREV_BUFFER(ip)) + for (ip = CPP_BUFFER(pfile); ip != CPP_NULL_BUFFER(pfile); ip = CPP_PREV_BUFFER(ip)) if (ip->fname) true_indepth++; @@ -2493,7 +2493,7 @@ initialize_builtins(cpp_reader * pfile) struct tm *timebuf = timestamp(pfile); cpp_buffer *pbuffer = CPP_BUFFER(pfile); - while (CPP_PREV_BUFFER(pbuffer)) + while (CPP_PREV_BUFFER(pbuffer) != CPP_NULL_BUFFER(pfile)) pbuffer = CPP_PREV_BUFFER(pbuffer); sprintf(directive, " __BASE_FILE__ \"%s\"\n", pbuffer->nominal_fname); output_line_command(pfile, 0, same_file); @@ -3221,7 +3221,7 @@ do_include(cpp_reader * pfile, struct directive *keyword, /* We have "filename". Figure out directory this source * file is coming from and put it on the front of the list. */ - for (fp = CPP_BUFFER(pfile); fp; fp = CPP_PREV_BUFFER(fp)) + for (fp = CPP_BUFFER(pfile); fp != CPP_NULL_BUFFER(pfile); fp = CPP_PREV_BUFFER(fp)) { int n; const char *ep, *nam; @@ -3286,7 +3286,7 @@ do_include(cpp_reader * pfile, struct directive *keyword, { cpp_buffer *fp; - for (fp = CPP_BUFFER(pfile); fp; fp = CPP_PREV_BUFFER(fp)) + for (fp = CPP_BUFFER(pfile); fp != CPP_NULL_BUFFER(pfile); fp = CPP_PREV_BUFFER(fp)) if (fp->fname) { /* fp->dir is null if the containing file was specified with @@ -3514,7 +3514,7 @@ do_include(cpp_reader * pfile, struct directive *keyword, { cpp_buffer *buf = CPP_BUFFER(pfile); - while ((buf = CPP_PREV_BUFFER(buf))) + while ((buf = CPP_PREV_BUFFER(buf)) != CPP_NULL_BUFFER(pfile)) putc('.', stderr); fprintf(stderr, "%s\n", fname); } |