Bug #81597 [NEW]: curl SIGSEGV with PROGRESS

From: Date: Mon, 08 Nov 2021 09:01:19 +0000
Subject: Bug #81597 [NEW]: curl SIGSEGV with PROGRESS
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237595@lists.php.net to get a copy of this message
From:             erik at coretech dot se
Operating system: 
PHP version:      8.0.12
Package:          cURL related
Bug Type:         Bug
Bug description:curl SIGSEGV with PROGRESS

Description:
------------
PHP crashes randomly with SIGSEGV (about 1/2 of the times) when the code
below is executed.

==805465== Thread 2:
==805465== Jump to the invalid address stated on the next line
==805465==    at 0xA08E150: ???
==805465==    by 0x82DC159: start_thread (in
/usr/lib64/libpthread-2.28.so)
==805465==    by 0x800BDD2: clone (in /usr/lib64/libc-2.28.so)
==805465==  Address 0xa08e150 is not stack'd, malloc'd or (recently)
free'd
==805465== 
==805465== 
==805465== Process terminating with default action of signal 11
(SIGSEGV): dumping core
==805465==  Access not within mapped region at address 0xA08E150
==805465==    at 0xA08E150: ???
==805465==    by 0x82DC159: start_thread (in
/usr/lib64/libpthread-2.28.so)
==805465==    by 0x800BDD2: clone (in /usr/lib64/libc-2.28.so)


Test script:
---------------
<?php

class curltest {

        public function start() {

                $this->ch = curl_init();

                $urlstr =
"https://www.php.net/distributions/php-8.0.12.tar.gz";

                curl_setopt($this->ch, CURLOPT_URL, $urlstr);
                curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, FALSE);
                curl_setopt($this->ch, CURLOPT_WRITEFUNCTION,
array($this, 'do_write'));
                curl_setopt($this->ch, CURLOPT_PROGRESSFUNCTION,
array($this, 'do_progress'));
                curl_setopt($this->ch, CURLOPT_NOPROGRESS, FALSE);
                curl_setopt($this->ch, CURLOPT_NOSIGNAL, TRUE);

                $ret = curl_exec($this->ch);
        }

	private function do_write($ch, $data) {
                return strlen($data);
        }

	private function do_progress($ch, $a = NULL, $b = NULL, $c = NULL, $d =
NULL) {
                return 1;
        }

}

$c = new curltest();
$c->start();


Expected result:
----------------
No crash

Actual result:
--------------
Crashes with SIGSEGV

-- 
Edit bug report at https://bugs.php.net/bug.php?id=81597&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81597&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81597&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81597&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81597&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81597&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81597&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81597&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81597&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81597&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81597&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81597&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81597&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81597&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81597&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81597&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81597&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81597&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#237595) next »