Mesa (glsl-pp-rework-1): glsl: Raise an error on an unfinished comment block.

Michał Król michal at kemper.freedesktop.org
Mon Jun 15 00:50:55 PDT 2009


Module: Mesa
Branch: glsl-pp-rework-1
Commit: 30667529a66d3df75d540b7420cf858d5e619627
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=30667529a66d3df75d540b7420cf858d5e619627

Author: Michal Krol <michal at vmware.com>
Date:   Sat Jun 13 13:50:45 2009 +0200

glsl: Raise an error on an unfinished comment block.

---

 src/glsl/pp/sl_pp_purify.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/glsl/pp/sl_pp_purify.c b/src/glsl/pp/sl_pp_purify.c
index 7fbfc78..ded4dc8 100644
--- a/src/glsl/pp/sl_pp_purify.c
+++ b/src/glsl/pp/sl_pp_purify.c
@@ -152,6 +152,9 @@ _purify_comment(const char *input,
                   return eaten;
                }
             }
+            if (next == '\0') {
+               return 0;
+            }
          }
       }
    }
@@ -171,8 +174,13 @@ sl_pp_purify(const char *input,
 
    for (;;) {
       char c;
+      unsigned int eaten;
 
-      input += _purify_comment(input, &c);
+      eaten = _purify_comment(input, &c);
+      if (!eaten) {
+         return -1;
+      }
+      input += eaten;
 
       if (out_len >= out_max) {
          unsigned int new_max = out_max;



More information about the mesa-commit mailing list