curl_copy_handle segfault with CURLOPT_FILE. The refcount was incremented
before the assignement.
with run-test.php). (Laruence)
- CURL:
+ . Fixed bug #62839 (curl_copy_handle segfault with CURLOPT_FILE). (Pierrick)
. Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false).
(r.hampartsumyan@gmail.com, Laruence)
dupch->uses = 0;
ch->uses++;
if (ch->handlers->write->stream) {
- Z_ADDREF_P(dupch->handlers->write->stream);
- dupch->handlers->write->stream = ch->handlers->write->stream;
+ Z_ADDREF_P(ch->handlers->write->stream);
}
+ dupch->handlers->write->stream = ch->handlers->write->stream;
dupch->handlers->write->method = ch->handlers->write->method;
dupch->handlers->write->type = ch->handlers->write->type;
if (ch->handlers->read->stream) {
--- /dev/null
+--TEST--
+Bug #62839 (curl_copy_handle segfault with CURLOPT_FILE)
+--SKIPIF--
+<?php if (!extension_loaded("curl")) print "skip";
+?>
+--FILE--
+<?php
+$curl = curl_init();
+
+$fd = fopen('/tmp/test', 'wb');
+curl_setopt($curl, CURLOPT_FILE, $fd);
+
+curl_copy_handle($curl);
+
+echo 'DONE!';
+?>
+--EXPECTF--
+DONE!