bugGNU Wget - Bugs: bug #36570, Wget Segfaults on Converting Links

 
 

bug #36570: Wget Segfaults on Converting Links

Submitter:  None
Submitted:  Thu 31 May 2012 06:40:33 PM UTC
   
 
Category:  Crash/Freeze/Infloop Severity:  3 - Normal
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Preston Maness Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  trunk
Operating System:  GNU/Linux Reproducibility:  Every Time
Fixed Release:  None Planned Release:  None
Regression:  None Work Required:  None
Patch Included:  No
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 03 Jun 2012 08:52:55 PM UTC, comment #2: 

Yep. Angel Gonzalez was able to fix it! He submitted a patch to the bug-wget list, viewable here:

http://git.savannah.gnu.org/cgit/wget.git/commit/?id=ee9d4a905769c7bdfad94947c48aaada329fc9de

I can confirm that the test case described below now works. Thanks a million Angel! I don't see an option to close the bug, but the fix submitted works. Consider bug closed :D

Angel Gonzalez's fix:

diff --git a/ChangeLog b/ChangeLog
index aa249b0..2f0f965 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-31 Ángel González <keisial@gmail.com>
+
+ * convert.c: fix segfault on wrong urls (bug 36570)
+
2012-05-13 Giuseppe Scrivano <gscrivano@gnu.org>

  • bootstrap.conf (gnulib_modules): Add `git-version-gen'.

diff --git a/src/convert.c b/src/convert.c
index e1c58e9..f5a9cba 100644
--- a/src/convert.c
+++ b/src/convert.c
@@ -124,6 +124,9 @@ convert_links_in_hashtable (struct hash_table *downloaded_set,
set_uri_encoding (pi, opt.locale, true);
u = url_parse (cur_url->url->url, NULL, pi, true);
+ if (!u)
+ continue;
+
local_name = hash_table_get (dl_url_file_map, u->url);
/* Decide on the conversion type. */

Anonymous
Sun 03 Jun 2012 08:25:01 AM UTC, comment #1: 

Works for me... I wasn't able to reproduce this, all went smoothly with a git master.

Evgeniy Philippov <molchuvka>
Thu 31 May 2012 06:40:33 PM UTC, original submission:  

Occurs in 1.13.4 as well.

$ git clone git://git.sv.gnu.org/wget.git && cd wget
$ export CFLAGS='-g'
$ ./bootstrap && ./configure && ./make

===============================================

$ gdb ./wget
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/preston/wget-latest/wget-latest...done.
(gdb) set args -d -o debug.log --html-extension --page-requisites -k -e robots=off --exclude-directories=wiki,forums --reject "*action=print" -w 1 --random-wait --warc-file=cpr-wp-debug http://www.cyberpunkreview.com/movie/upcoming-movies/initial-impressions-review-of-solid-state-society/
(gdb) run
Starting program: /home/preston/wget-latest/wget-latest -d -o debug.log --html-extension --page-requisites -k -e robots=off --exclude-directories=wiki,forums --reject "*action=print" -w 1 --random-wait --warc-file=cpr-wp-debug http://www.cyberpunkreview.com/movie/upcoming-movies/initial-impressions-review-of-solid-state-society/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Setting --output-file (logfile) to debug.log
Setting --html-extension (adjustextension) to 1
Setting --page-requisites (pagerequisites) to 1
Setting --convert-links (convertlinks) to 1
Setting robots (robots) to off
Setting --exclude-directories (excludedirectories) to wiki,forums
Setting --reject (reject) to *action=print
Setting --wait (wait) to 1
Setting --random-wait (randomwait) to 1
Setting --warc-file (warcfile) to cpr-wp-debug

Program received signal SIGSEGV, Segmentation fault.
0x00000000004063a6 in convert_links_in_hashtable (downloaded_set=0x680b60,
    is_css=0, file_count=0x7fffffffdf2c) at convert.c:127
127           local_name = hash_table_get (dl_url_file_map, u->url);
(gdb) backtrace
#0  0x00000000004063a6 in convert_links_in_hashtable (downloaded_set=0x680b60,
    is_css=0, file_count=0x7fffffffdf2c) at convert.c:127
#1  0x0000000000406500 in convert_all_links () at convert.c:189
#2  0x0000000000428e2c in main (argc=17, argv=0x7fffffffe258) at main.c:1634
(gdb) info locals
local_name = 0x680d40 "www.cyberpunkreview.com/movie/upcoming-movies/initial-impressions-review-of-solid-state-society/index.html"
u = 0x0
pi = 0x679ae0
urls = 0x6c48c0
cur_url = 0x69c9f0
url = 0x680c50 "http://www.cyberpunkreview.com/movie/upcoming-movies/initial-impressions-review-of-solid-state-society/"
file = 0x680f10 "www.cyberpunkreview.com/movie/upcoming-movies/initial-impressions-review-of-solid-state-society/index.html"
i = 0
cnt = 1
file_array = 0x7fffffffde80
(gdb) info args
downloaded_set = 0x680b60
is_css = 0
file_count = 0x7fffffffdf2c

===============================================

The "debug.log" file is attached.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25967:  debug.log added by None (722KiB - text/x-log)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rockdaboot (Updated the item)
  • -email is unavailable- added by molchuvka (Posted a comment)
  • -email is unavailable- added by molchuvka
  • -email is unavailable- added by None (Submitted the item)
  •  

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-01 rockdaboot StatusNone Fixed
        Open/ClosedOpen Closed
    2012-06-03 molchuvka Carbon-Copy- Added molchuvka
    2012-05-31 None Attached File- Added debug.log, #25967

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code