Anees Shaikh <[EMAIL PROTECTED]> writes:

> So I think the problem is with malformed img tags.  The parser fails
> if the tag is of this form:
> 
>    <img src="/library/homepage/images/curve.gif" alt="" border="0" />
[...]
> This problem with img tags seems to be quite common (redhat.com,
> ibm.com, microsoft.com) maybe due to some authoring tools.

That's supposed to be legal XML and some people are using it for
"XHTML" compliance -- the final / says that the tag is closed
immediately.  I plan to fix the parser to not barf on it.

> Note the end of the tag is closed with "/>" instead of just ">" as
> in the spec.  When the parser finds the "/" it thinks it sets
> attr_name_begin to the "/" and then attr_name_end gets set to the
> same thing.

Yes.  If it weren't for the XML novelties, it would be a feature.

> Unfortunately in this case the parser also seg faults in the call to
> strlen() in the array_allowed() function.

Be careful that you're correctly consing up the arrays (they have to
be NULL-terminated) and that your stack isn't corrupted or something
like that.

Also, I've recently fixed an important bug in DO_REALLOC_FROM_ALLOCA:

Index: wget.h
===================================================================
RCS file: /pack/anoncvs/wget/src/wget.h,v
retrieving revision 1.23
retrieving revision 1.25
diff -u -r1.23 -r1.25
--- wget.h      2001/05/27 19:35:15     1.23
+++ wget.h      2001/06/26 09:48:51     1.25
@@ -231,24 +231,24 @@
 {                                                                              \
   /* Avoid side-effectualness.  */                                             \
   long do_realloc_needed_size = (needed_size);                                 \
-  long do_realloc_newsize = 0;                                                 \
-  while ((sizevar) < (do_realloc_needed_size)) {                               \
-    do_realloc_newsize = 2*(sizevar);                                          \
+  long do_realloc_newsize = (sizevar);                                         \
+  while (do_realloc_newsize < do_realloc_needed_size) {                               
+ \
+    do_realloc_newsize <<= 1;                                                  \
     if (do_realloc_newsize < 16)                                               \
       do_realloc_newsize = 16;                                                 \
-    (sizevar) = do_realloc_newsize;                                            \
   }                                                                            \
-  if (do_realloc_newsize)                                                      \
+  if (do_realloc_newsize != (sizevar))                                         \
     {                                                                          \
       if (!allocap)                                                            \
        XREALLOC_ARRAY (basevar, type, do_realloc_newsize);                     \
       else                                                                     \
        {                                                                       \
          void *drfa_new_basevar = xmalloc (do_realloc_newsize);                \
-         memcpy (drfa_new_basevar, basevar, sizevar);                          \
+         memcpy (drfa_new_basevar, basevar, (sizevar));                        \
          (basevar) = drfa_new_basevar;                                         \
          allocap = 0;                                                          \
        }                                                                       \
+      (sizevar) = do_realloc_newsize;                                          \
     }                                                                          \
 } while (0)
 

Reply via email to