Bug 1169022

Summary: [abrt] wget: ftp_expected_bytes(): wget killed by SIGSEGV
Product: [Fedora] Fedora Reporter: Robert Hancock <hancockrwd>
Component: wgetAssignee: Tomáš Hozza <thozza>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: frigoris.ma, gajownik, micah, thozza
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/32e6ec412f086171a05541c82485094bf271bbef
Whiteboard: abrt_hash:833e586dade657e59cf7069af7c8cdc0d853162d
Fixed In Version: wget-1.16.1-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-20 08:47:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cgroup
none
File: core_backtrace
none
File: dso_list
none
File: environ
none
File: exploitable
none
File: limits
none
File: maps
none
File: open_fds
none
File: proc_pid_status
none
File: var_log_messages
none
Prevent null pointer dereferencing when calling ftp_expected_bytes() none

Description Robert Hancock 2014-11-29 03:26:17 UTC
Description of problem:
During OpenWRT compile

Version-Release number of selected component:
wget-1.16-3.fc20

Additional info:
reporter:       libreport-2.2.3
backtrace_rating: 4
cmdline:        wget -t5 --timeout=20 --no-check-certificate -O- ftp://ftp.denx.de/pub/u-boot/u-boot-2014.07.tar.bz2
crash_function: ftp_expected_bytes
executable:     /usr/bin/wget
kernel:         3.17.4-200.fc20.x86_64
runlevel:       N 5
type:           CCpp
uid:            1000

Truncated backtrace:
Thread no. 1 (5 frames)
 #0 ftp_expected_bytes at ftp.c:91
 #1 getftp at ftp.c:1349
 #2 ftp_loop_internal at ftp.c:1679
 #3 ftp_loop at ftp.c:2466
 #4 retrieve_url at retr.c:806

Comment 1 Robert Hancock 2014-11-29 03:26:20 UTC
Created attachment 962633 [details]
File: backtrace

Comment 2 Robert Hancock 2014-11-29 03:26:21 UTC
Created attachment 962634 [details]
File: cgroup

Comment 3 Robert Hancock 2014-11-29 03:26:21 UTC
Created attachment 962635 [details]
File: core_backtrace

Comment 4 Robert Hancock 2014-11-29 03:26:22 UTC
Created attachment 962636 [details]
File: dso_list

Comment 5 Robert Hancock 2014-11-29 03:26:23 UTC
Created attachment 962637 [details]
File: environ

Comment 6 Robert Hancock 2014-11-29 03:26:24 UTC
Created attachment 962638 [details]
File: exploitable

Comment 7 Robert Hancock 2014-11-29 03:26:25 UTC
Created attachment 962639 [details]
File: limits

Comment 8 Robert Hancock 2014-11-29 03:26:26 UTC
Created attachment 962640 [details]
File: maps

Comment 9 Robert Hancock 2014-11-29 03:26:27 UTC
Created attachment 962641 [details]
File: open_fds

Comment 10 Robert Hancock 2014-11-29 03:26:28 UTC
Created attachment 962642 [details]
File: proc_pid_status

Comment 11 Robert Hancock 2014-11-29 03:26:28 UTC
Created attachment 962643 [details]
File: var_log_messages

Comment 12 Cong Ma 2014-12-15 11:20:27 UTC
Created attachment 968903 [details]
Prevent null pointer dereferencing when calling ftp_expected_bytes()

Hi, any news on this bug?  I also got this segfaults during FTP download when the network is choppy at times.

It appears to be caused by dereferencing a null pointer, as a result of not checking a return value for an exception.  I think the patch should fix it (at least preventing this particular crash).  I've done some extremely rudimentary checks -- basically simulating a "pulling the cable plug" event on a virtual tunnel interface during FTP transfer -- and the patch seemed to do the work (whereas the unpatched wget build crashed).  Still, I hope that expert eyes could be cast on this issue.

Comment 13 Tomáš Hozza 2014-12-15 11:52:29 UTC
Hi.

Thank you for proposing a patch. I didn't have time to look at the issue yet. I'll have a look at your patch. Will you post it on the wget-bug mailing list?

Comment 14 Tomáš Hozza 2014-12-15 13:50:54 UTC
Hi.

The patch looks reasonable. I think it makes sense to dereference respline after the return value of ftp_response().

Will you send the fix to upstream?

Comment 15 Tomáš Hozza 2014-12-15 13:51:53 UTC
(In reply to Tomas Hozza from comment #14)
> Hi.
> 
> The patch looks reasonable. I think it makes sense to dereference respline
> after the return value of ftp_response().
*is checked...

Comment 16 Cong Ma 2014-12-15 13:57:04 UTC
(In reply to Tomas Hozza from comment #14)
> Hi.
> 
> The patch looks reasonable. I think it makes sense to dereference respline
> after the return value of ftp_response().
> 
> Will you send the fix to upstream?

Thanks for pointing me to the wget-bug list.  Yes, I'm going to send it and request upstream review.

Comment 17 Cong Ma 2014-12-17 03:09:41 UTC
Patch is now in upstream repo (git commit 26790c3); should be included with next wget release.

Comment 18 Tomáš Hozza 2014-12-17 07:44:20 UTC
(In reply to Cong Ma from comment #17)
> Patch is now in upstream repo (git commit 26790c3); should be included with
> next wget release.

I saw the mail on upstream mailing list and prepared build for Fedora already yesterday, but didn't push the update.

Thanks!

Comment 19 Fedora Update System 2014-12-17 11:08:22 UTC
wget-1.16.1-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/wget-1.16.1-2.fc20

Comment 20 Fedora Update System 2014-12-17 11:11:40 UTC
wget-1.16.1-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/wget-1.16.1-2.fc21

Comment 21 Fedora Update System 2014-12-18 06:06:06 UTC
Package wget-1.16.1-2.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing wget-1.16.1-2.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-17134/wget-1.16.1-2.fc21
then log in and leave karma (feedback).

Comment 22 Fedora Update System 2014-12-20 08:47:21 UTC
wget-1.16.1-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2014-12-23 18:30:03 UTC
wget-1.16.1-2.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.