raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1dc443a1a6e28320b9da6a8d5a12715dcc691115

commit 1dc443a1a6e28320b9da6a8d5a12715dcc691115
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Mon Jul 31 11:31:04 2017 +0900

    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
---
 src/bin/edje/epp/cpplib.c | 12 ++++++------
 1 file 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);
          }

-- 


Reply via email to