changeset 987:246df486915c

fix CSS string parsing bug
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 06 Mar 2009 21:44:15 +0100
parents 6d00a9e16696
children cc974615ae39
files ChangeLog src/cssparser.cc
diffstat 2 files changed, 7 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Mar 06 12:10:38 2009 +0100
+++ b/ChangeLog	Fri Mar 06 21:44:15 2009 +0100
@@ -67,6 +67,7 @@
  - Reduce number of styleEngine::style0() calls.
  - Replace bg_color dillorc option.
  - Remove text_color, link_color, and force_my_colors dillorc options.
+ - Fix CSS string parsing bug.
    Patches: Johannes Hofmann
 +- Updated the GPL copyright note in the source files.
    Patch: Detlef Riekenberg
--- a/src/cssparser.cc	Fri Mar 06 12:10:38 2009 +0100
+++ b/src/cssparser.cc	Fri Mar 06 21:44:15 2009 +0100
@@ -396,7 +396,6 @@
 {
    int c, c1, d, j;
    char hexbuf[5];
-   bool escaped;
    int i = 0;
 
    parser->ttype = CSS_TK_CHAR; /* init */
@@ -501,11 +500,9 @@
 
       i = 0;
       c = Css_getc(parser);
-      escaped = false;
 
-      while (c != EOF && (escaped || c != c1)) {
+      while (c != EOF && c != c1) {
          if (c == '\\') {
-            escaped = true;
             d = Css_getc(parser);
             if (isxdigit(d)) {
                /* Read hex Unicode char. (Actually, strings are yet only 8
@@ -521,11 +518,11 @@
                hexbuf[j] = 0;
                Css_ungetc(parser);
                c = strtol(hexbuf, NULL, 16);
-            } else
-               /* Take next character literally. */
-               c = Css_getc(parser);
-         } else
-            escaped = false;
+            } else {
+               /* Take character literally. */
+               c = d;
+            }
+         }
 
          if (i < MAX_STR_LEN - 1) {
             parser->tval[i] = c;