Bug 723075

Summary: Segfault when downloading two RPMs from a scratch build
Product: [Fedora] Fedora Reporter: Garrett Holmstrom <gholms>
Component: curlAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: kdudka, paul
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: curl-7.21.0-10.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-07 03:37:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Garrett Holmstrom 2011-07-19 00:25:01 UTC
Description of problem:
Downloading two RPMs from a koji scratch build, the first with -O and -J flags, and the second with none, seems to cause a segfault.  The relevant gdb session follows:

[9069] gholms@asbestos ~ % gdb /usr/bin/curl
GNU gdb (GDB) Fedora (7.2-51.fc14)
Copyright (C) 2010 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/curl...Reading symbols from /usr/lib/debug/usr/bin/curl.debug...done.
done.
(gdb) run -O -J 'http://koji.fedoraproject.org/koji/getfile?taskID=3208065&name=python26-boto-2.0-1.el5.noarch.rpm' 'http://koji.fedoraproject.org/koji/getfile?taskID=3208065&name=python26-boto-2.0-1.el5.src.rpm'
Starting program: /usr/bin/curl -O -J 'http://koji.fedoraproject.org/koji/getfile?taskID=3208065&name=python26-boto-2.0-1.el5.noarch.rpm' 'http://koji.fedoraproject.org/koji/getfile?taskID=3208065&name=python26-boto-2.0-1.el5.src.rpm'
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff214a700 (LWP 20924)]
[Thread 0x7ffff214a700 (LWP 20924) exited]
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  747k  100  747k    0     0   807k      0 --:--:-- --:--:-- --:--:--  854k
curl: Saved to filename 'python26-boto-2.0-1.el5.noarch.rpm'

Program received signal SIGSEGV, Segmentation fault.
0x0000000000405d74 in header_callback (ptr=<value optimized out>, size=<value optimized out>, 
    nmemb=<value optimized out>, stream=0x0) at main.c:4389
4389	        outs->filename = filename;
(gdb) bt
#0  0x0000000000405d74 in header_callback (ptr=<value optimized out>, size=<value optimized out>, 
    nmemb=<value optimized out>, stream=0x0) at main.c:4389
#1  0x000000343761a3b9 in Curl_client_write (conn=<value optimized out>, type=<value optimized out>, 
    ptr=0x62c120 "Content-Disposition: attachment; filename=python26-boto-2.0-1.el5.src.rpm\r\n", len=75)
    at sendf.c:487
#2  0x0000003437618f2f in Curl_http_readwrite_headers (data=0x623560, conn=0x62ddd0, nread=0x7fffffffd6d0, 
    stop_reading=0x7fffffffd6de) at http.c:3779
#3  0x000000343762c632 in readwrite_data (conn=0x62ddd0, done=0x7fffffffd78e) at transfer.c:455
#4  Curl_readwrite (conn=0x62ddd0, done=0x7fffffffd78e) at transfer.c:1004
#5  0x000000343762dd47 in Transfer (data=0x623560) at transfer.c:1367
#6  Curl_do_perform (data=0x623560) at transfer.c:2053
#7  0x000000000040890c in operate (argc=0, argv=<value optimized out>) at main.c:5358
#8  main (argc=0, argv=<value optimized out>) at main.c:5683

Version-Release number of selected component (if applicable):
curl-7.21.0-8.fc14.x86_64

How reproducible:
Seemingly only with these particular URIs

Steps to Reproduce:
1. curl -O -J 'http://koji.fedoraproject.org/koji/getfile?taskID=3208065&name=python26-boto-2.0-1.el5.noarch.rpm' 'http://koji.fedoraproject.org/koji/getfile?taskID=3208065&name=python26-boto-2.0-1.el5.src.rpm'
  
Actual results:
python26-boto-2.0-1.el5.noarch.rpm written to disk, segmentation fault

Expected results:
python26-boto-2.0-1.el5.noarch.rpm written to disk, binary garbage printed to screen

Additional info:
I realize that printing an RPM to the console is not very useful; I was simply learning by doing. ;)

Comment 1 Kamil Dudka 2011-08-04 21:53:54 UTC
upstream commit:

https://github.com/bagder/curl/commit/5eb2396

Thanks Paul Howarth for reporting it upstream and Daniel Stenberg for fixing it!

Comment 2 Kamil Dudka 2011-08-15 21:14:38 UTC
fixed in curl-7.21.7-3.fc17

Comment 3 Fedora Update System 2011-08-16 07:12:44 UTC
curl-7.21.3-10.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/curl-7.21.3-10.fc15

Comment 4 Fedora Update System 2011-08-16 07:13:02 UTC
curl-7.21.7-3.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/curl-7.21.7-3.fc16

Comment 5 Garrett Holmstrom 2011-08-16 15:46:45 UTC
Thanks!  How about F14?

Comment 6 Kamil Dudka 2011-08-16 17:41:44 UTC
(In reply to comment #5)
> Thanks!  How about F14?

I am not sure how many people use F14.  curl is on critpath, which makes it harder to get it to the stable update repository.  Nevertheless, if you pass it through the Fedora update bureaucracy, you will have it ;-)

Comment 7 Fedora Update System 2011-08-16 18:41:10 UTC
curl-7.21.0-9.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/curl-7.21.0-9.fc14

Comment 8 Fedora Update System 2011-08-16 20:07:24 UTC
Package curl-7.21.7-3.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing curl-7.21.7-3.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/curl-7.21.7-3.fc16
then log in and leave karma (feedback).

Comment 9 Garrett Holmstrom 2011-08-18 03:15:36 UTC
Unfortunately, curl-7.21.0-9.fc14.x86_64 doesn't seem to fix this issue.

The URIs below differ from those in the original report since koji deleted the originals.

% rpm -q curl
curl-7.21.0-9.fc14.x86_64
% curl -O -J 'http://koji.fedoraproject.org/koji/getfile?taskID=3281612&name=ibus-1.3.99.20110419-15.fc15.x86_64.rpm' 'http://koji.fedoraproject.org/koji/getfile?taskID=3281612&name=ibus-libs-1.3.99.20110419-15.fc15.x86_64.rpm' >/dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  388k  100  388k    0     0   352k      0  0:00:01  0:00:01 --:--:--  366k
[1]    12536 segmentation fault (core dumped)  curl -O -J   > /dev/null

Comment 10 Garrett Holmstrom 2011-08-22 23:09:48 UTC
This seems to be fixed in curl-7.21.0-10.fc14.x86_64.  Thanks!

Comment 11 Fedora Update System 2011-09-07 03:37:40 UTC
curl-7.21.7-4.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2011-09-08 07:10:32 UTC
curl-7.21.3-11.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2011-09-25 03:39:48 UTC
curl-7.21.0-10.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.