mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed bug #68937 (Segfault in curl_multi_exec)
This commit is contained in:
parent
56ab00b0fe
commit
73288bbea4
2 changed files with 38 additions and 2 deletions
|
@ -1486,8 +1486,12 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
|||
|
||||
ZVAL_RES(&argv[0], ch->res);
|
||||
Z_ADDREF(argv[0]);
|
||||
ZVAL_RES(&argv[1], t->res);
|
||||
Z_ADDREF(argv[1]);
|
||||
if (t->res) {
|
||||
ZVAL_RES(&argv[1], t->res);
|
||||
Z_ADDREF(argv[1]);
|
||||
} else {
|
||||
ZVAL_NULL(&argv[1]);
|
||||
}
|
||||
ZVAL_LONG(&argv[2], (int)size * nmemb);
|
||||
|
||||
fci.size = sizeof(fci);
|
||||
|
|
32
ext/curl/tests/bug68937.phpt
Normal file
32
ext/curl/tests/bug68937.phpt
Normal file
|
@ -0,0 +1,32 @@
|
|||
--TEST--
|
||||
Bug # #68937 (Segfault in curl_multi_exec)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
|
||||
include 'skipif.inc';
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$ch = curl_init('http://www.google.com/');
|
||||
curl_setopt_array($ch, array(
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_INFILESIZE => 1,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Length: 1',
|
||||
),
|
||||
CURLOPT_READFUNCTION => 'curl_read'
|
||||
));
|
||||
|
||||
function curl_read($ch, $fp, $len) {
|
||||
var_dump($fp);
|
||||
exit;
|
||||
}
|
||||
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
?>
|
||||
--EXPECTF--
|
||||
NULL
|
Loading…
Add table
Add a link
Reference in a new issue