curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fetching https ressource, occuring memory error

From: Jan <jan_at_dwrox.net>
Date: Tue, 14 Feb 2017 20:35:52 +0100

Hello,

unfortunately I dont know how to get the debugging symbols up and
running using cmake, I tried switching it on using ccmake-gui and enable
debug, but after make and make install nothing shows up in Valgrind and
or Valkyrie.

But following the output of Valgrind.

It seems the problem originates from "Curl_raw_nequal" and not
strncasecmp... which I thought seeing yesterday.

I have to admit, I use also such an option:

--------------------------------------------------------------------
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, "Key:abcdefz1234567");
--------------------------------------------------------------------

Im not sure if this is connected somehow, but that worked fine using the
command line interface:
curl -X GET --header "X-Key:abcdefz1234567" --url
'https://url.org/interface?param1=string1&param2=string2'

Anyhow, thanks for following this up!

Here is the Valgrind output:
---------------------------------------------------------------------

==25592== Memcheck, a memory error detector
==25592== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==25592== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==25592== Command: ./program
==25592== Parent PID: 18066
==25592==
==25592== Invalid read of size 1
==25592== at 0x524D4C1: Curl_raw_nequal (in /usr/lib/libcurl.so)
==25592== by 0x52061EA: Curl_checkheaders (in /usr/lib/libcurl.so)
==25592== by 0x5208996: Curl_http (in /usr/lib/libcurl.so)
==25592== by 0x523A0DC: multi_do (in /usr/lib/libcurl.so)
==25592== by 0x523AD30: multi_runsingle (in /usr/lib/libcurl.so)
==25592== by 0x523BC76: curl_multi_perform (in /usr/lib/libcurl.so)
==25592== by 0x5230F0D: easy_transfer (in /usr/lib/libcurl.so)
==25592== by 0x52310DC: easy_perform (in /usr/lib/libcurl.so)
==25592== by 0x523112D: curl_easy_perform (in /usr/lib/libcurl.so)
==25592== by 0x108B69: main (program.c:63)
==25592== Address 0x653a79656b697041 is not stack'd, malloc'd or
(recently) free'd
==25592==
==25592==
==25592== Process terminating with default action of signal 11 (SIGSEGV)
==25592== General Protection Fault
==25592== at 0x524D4C1: Curl_raw_nequal (in /usr/lib/libcurl.so)
==25592== by 0x52061EA: Curl_checkheaders (in /usr/lib/libcurl.so)
==25592== by 0x5208996: Curl_http (in /usr/lib/libcurl.so)
==25592== by 0x523A0DC: multi_do (in /usr/lib/libcurl.so)
==25592== by 0x523AD30: multi_runsingle (in /usr/lib/libcurl.so)
==25592== by 0x523BC76: curl_multi_perform (in /usr/lib/libcurl.so)
==25592== by 0x5230F0D: easy_transfer (in /usr/lib/libcurl.so)
==25592== by 0x52310DC: easy_perform (in /usr/lib/libcurl.so)
==25592== by 0x523112D: curl_easy_perform (in /usr/lib/libcurl.so)
==25592== by 0x108B69: main (program.c:63)

---------------------------------------------------------------------

On 14.02.2017 14:57, Daniel Stenberg wrote:
> On Tue, 14 Feb 2017, jan_at_dwrox.net wrote:
>
>> I try to connect to an https ressource using libcurls easy interface.
>> But the program crashes on the easy_perfom() call with an illegal read
>> of size 1. According to Valgrind testing on Linux, the error occurs at
>> strncasecmp.
>
> That is unexpected. Using OpenSSL I presume?
>
> Can you show us some more details from valgrinds report?
>
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-02-14