[xml] Re: Reversed test in htmlParseLookupSequence
- From: Soeren Sandmann <sandmann daimi au dk>
- To: xml gnome org
- Subject: [xml] Re: Reversed test in htmlParseLookupSequence
- Date: 09 Jul 2002 19:42:46 +0200
Soeren Sandmann <sandmann daimi au dk> writes:
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.
It turned out that that wasn't a full fix. When the LookupSequence
function looks for sequences, it skips comments. This will cause it to
fail if it is looking for the end of a comment.
Here is a new patch that special-cases looking for end-of-comment, but
I am not sure at all that this is the right fix.
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 17:36:03 -0000
@@ -3909,13 +3909,15 @@
/* 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] == '>')) {
incomment = 0;
base += 2;
}
+ if (first == '-' && next == '-' && third == '>')
+ return(base - (in->cur - in->base));
continue;
}
if (buf[base] == first) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]