On Mon, 24 Sep 2001, Lenny Foner wrote:

> utils.c:906: failed assertion `length > 0'

This is the key issue here.

The "file" read by wget (which happens to be a directory in this case)
returns a zero length line and the assert() line warns about this and then
aborts. The core you get is due to this SIGABRT.

This stack:

#3  0x27b64 in __eprintf (string=0x7b037054 "", expression=0x1 "", line=1058,
    filename=0x7ae9f720
"z�\002�z��@z�+\200z��@z�\177hz��@z�\177�z��@{\003V\210")

is in the assert() macro/function that proves it.

I would fix that assert() to be a better check and return a proper error
message and return NULL. Something along these lines:

diff -u -r1.21 utils.c
--- utils.c     2001/05/27 19:35:12     1.21
+++ utils.c     2001/09/24 08:17:38
@@ -903,7 +903,12 @@
   while (fgets (line + length, bufsize - length, fp))
     {
       length += strlen (line + length);
-      assert (length > 0);
+      if (0 == length)
+        {
+          /* bad input file */
+          xfree(line);
+          return NULL;
+        }
       if (line[length - 1] == '\n')
        break;
       /* fgets() guarantees to read the whole line, or to use up the


-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol




Reply via email to