[xml] Reversed test in htmlParseLookupSequence



I was using the html parser in a wget-style application that downloads
web pages and all their inlined images, and I noticed very long delays
before the parser would report the first IMG tag if the page contained
SCRIPT or STYLE tags. 

I tracked the problem down to what I think is a reversed test in
htmlParseLookupSequence(). The original test looks to me like it is
intended to make sure that the index base + 2 is valid. If that is the
case, then the test is reversed.

(Please cc me on replies, as I am not subscribed to this list)

Søren

Index: HTMLparser.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/HTMLparser.c,v
retrieving revision 1.116
diff -u -r1.116 HTMLparser.c
--- HTMLparser.c        5 Jul 2002 18:17:09 -0000       1.116
+++ HTMLparser.c        9 Jul 2002 16:02:52 -0000
@@ -3909,7 +3909,7 @@
            /* do not increment base, some people use <!--> */
        }
        if (incomment) {
-           if (base + 3 < len)
+           if (base + 3 > len)
                return(-1);
            if ((buf[base] == '-') && (buf[base + 1] == '-') &&
                (buf[base + 2] == '>')) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]