]> sjero.net Git - wget/commitdiff
[svn] Fix #20811: Assertion failure with --spider --recursive.
authormicah <devnull@localhost>
Thu, 30 Aug 2007 04:36:30 +0000 (21:36 -0700)
committermicah <devnull@localhost>
Thu, 30 Aug 2007 04:36:30 +0000 (21:36 -0700)
src/ChangeLog
src/spider.c
src/url.c

index 6165534ed5efc4b213fc99a6ce27cfaffe80f146..74b58e4e2a5f47829223d10067e9b131eccd74f8 100644 (file)
        RETRUNNEEDED appears never to be referenced outside of
        http.c (and wget.h), and, when returned by gethttp, is
        translated by http_loop to RETROK.
+       * url.c (are_urls_equal): Don't call getchar_from_escaped_string
+       if u2 is shorter than u1.
+       (test_are_urls_equal): Added tests to handle u2 shorter than u1,
+       and %2f not treated the same as / (latter currently fails).
+       * spider.c (in_url_list_p): Don't call are_urls_equal if one of
+       them is NULL.
 
 2007-08-23  Joshua David Williams  <yurimxpxman@gmail.com>
 
index 183d8d2b4333d89e318b3434e35d93dc6ea53e03..b0bda64c0e6551ee21332678cac0938a446a61c4 100644 (file)
@@ -74,7 +74,7 @@ in_url_list_p (const struct url_list *list, const char *url)
   for (ptr = list; ptr; ptr = ptr->next)
     {
       /* str[case]cmp is inadequate for URL comparison */
-      if (are_urls_equal (url, ptr->url)) 
+      if (ptr->url != NULL && are_urls_equal (url, ptr->url)) 
         return true;
     }
  
index 04ecb3a4f3429170bf0c574df531264edcb77023..683a7745f1b7eeb9ea7d3c9eddf8ac90b8c06976 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1971,11 +1971,12 @@ are_urls_equal (const char *u1, const char *u2)
   const char *p, *q;
   int pp, qq;
   char ch1, ch2;
+  assert(u1 && u2);
 
   p = u1;
   q = u2;
 
-  while (*p 
+  while (*p && *q
          && (pp = getchar_from_escaped_string (p, &ch1))
          && (qq = getchar_from_escaped_string (q, &ch2))
          && (TOLOWER(ch1) == TOLOWER(ch2)))
@@ -2111,6 +2112,8 @@ test_are_urls_equal()
     { "http://www.adomain.com/apath/", "http://www.adomain.com/anotherpath/", false },
     { "http://www.adomain.com/apath/", "http://www.anotherdomain.com/path/",  false },
     { "http://www.adomain.com/~path/", "http://www.adomain.com/%7epath/",     true },
+    { "http://www.adomain.com/longer-path/", "http://www.adomain.com/path/",  false },
+    { "http://www.adomain.com/path%2f", "http://www.adomain.com/path/",       false },
   };
   
   for (i = 0; i < sizeof(test_array)/sizeof(test_array[0]); ++i)