cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] libcurl/Curl_resolv_timeout: curl_jmpenv should be set before alarm() call

From: Ettore Del Negro <write_at_ettoredelnegro.me>
Date: Thu, 13 Oct 2011 13:33:05 +0200

Hello,
while debugging an issue in a PHP extension, i experienced some
segfaults caused by libcurl.
I found out the cause was at hostip.c:506:

siglongjmp(curl_jmpenv, 1);

curl_jmpenv was 0x0.
That happens when SIGALRM is sent *before* sigsetjmp is called at
hostip.c:609. This could happens, for example, while debugging or when
process is descheduled for a time greater than SIGALRM timeout.
The attached patch simply moves sigsetjmp() before alarm().

Regards,
Ettore

Received on 2011-10-13