php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64177 curl_multi_* crash with libcurl 7.29.0
Submitted: 2013-02-08 23:31 UTC Modified: 2013-02-17 20:40 UTC
From: ab@php.net Assigned: ab (profile)
Status: Closed Package: cURL related
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ab@php.net
New email:
PHP Version: OS:

 

 [2013-02-08 23:31 UTC] ab@php.net
Description:
------------
Perhaps that's a libcurl bug, but the curl extension multi functionality consistently fails with 7.29.0 . For instance this snippet based on ext/curl/tests/curl_multi_init_basic.phpt

$mh = curl_multi_init();
curl_multi_close($mh);

Basically it does crash always if no handles were added between init and cleanup. Ther corresponding snippet in c

#include <curl/curl.h>

int main(void)
{
  CURLM *multi_handle;

  multi_handle = curl_multi_init();

  curl_multi_cleanup(multi_handle);

  return 0;
}

That snippets do successfully work with the libcurl versions prior to 7.29.0 . The issue introduces itself starting with this commit in libcurl included in 7.29.0

https://github.com/bagder/curl/commit/c43127414d89ccb9ef6517081f68986d991bcfb3#L10R1776

And the commit is related to a big change explaned here http://daniel.haxx.se/blog/2013/01/17/internally-were-all-multi-now/

The issue is consistently reproduceable on linux and windows through all PHP versions.

Expected result:
----------------
no crash

Actual result:
--------------
#0  _php_curl_multi_close (rsrc=0xb707259c) at /home/weltling/dws/src/php-5.5-nts/ext/curl/multi.c:349
#1  0x085902ff in list_entry_destructor (ptr=0xb707259c) at /home/weltling/dws/src/php-5.5-nts/Zend/zend_list.c:183
#2  0x0858d72e in zend_hash_del_key_or_index (ht=0x8aa7158, arKey=0x0, nKeyLength=0, h=4, flag=1)
    at /home/weltling/dws/src/php-5.5-nts/Zend/zend_hash.c:531
#3  0x0858ffed in _zend_list_delete (id=4) at /home/weltling/dws/src/php-5.5-nts/Zend/zend_list.c:57
#4  0x081d1d8b in zif_curl_multi_close (ht=1, return_value=0xb7070b3c, return_value_ptr=0x0, this_ptr=0x0, 
    return_value_used=0) at /home/weltling/dws/src/php-5.5-nts/ext/curl/multi.c:330
#5  0x085b7f4b in zend_do_fcall_common_helper_SPEC (execute_data=0xb70540c4)
    at /home/weltling/dws/src/php-5.5-nts/Zend/zend_vm_execute.h:542
#6  0x085bdc7b in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xb70540c4)
    at /home/weltling/dws/src/php-5.5-nts/Zend/zend_vm_execute.h:2293
#7  0x085b695c in execute_ex (execute_data=0xb70540c4) at /home/weltling/dws/src/php-5.5-nts/Zend/zend_vm_execute.h:356
#8  0x085b7023 in zend_execute (op_array=0xb70713a8) at /home/weltling/dws/src/php-5.5-nts/Zend/zend_vm_execute.h:381
#9  0x0857ed2d in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /home/weltling/dws/src/php-5.5-nts/Zend/zend.c:1316
#10 0x085023ec in php_execute_script (primary_file=0xbfffdff0) at /home/weltling/dws/src/php-5.5-nts/main/main.c:2479
#11 0x086a7d59 in do_cli (argc=2, argv=0xbffff284) at /home/weltling/dws/src/php-5.5-nts/sapi/cli/php_cli.c:988
#12 0x086a8ec3 in main (argc=2, argv=0xbffff284) at /home/weltling/dws/src/php-5.5-nts/sapi/cli/php_cli.c:1364

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-15 09:32 UTC] pajoye@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: ab
 [2013-02-15 09:32 UTC] pajoye@php.net
This commit may fix this regression:

https://github.com/bagder/curl/commit/da3fc1ee91de656a30f3a12de394bcba55119872

@a please patch our libcurl and test again :)
 [2013-02-17 20:40 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2013-02-17 20:40 UTC] ab@php.net
That commit fixes this issue, obviously there can be no plausible workaround in php. I think curl 7.29.0 should be banned for regular PHP builds. I'll be using that patch to build with 7.29.0 for now (as no newer curl version is yet out).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC