Завиток в C ++ на Mac OSX с https, вызывающий ошибку сегментации через valgrind - PullRequest
0 голосов
/ 19 сентября 2018

Я пытаюсь отправить через curl запрос из c ++ на моем macOS (например, на linux все работает нормально).Но когда я запускаю программу через valgrind, а затем пытаюсь отправить запрос через curl, программа завершается с ошибкой сегментации.Даже в коде отсюда https://curl.haxx.se/libcurl/c/https.html, и я также пробую команду curl из терминала с valgrind, и даже тогда она не удалась, но это должен быть https.Я попробовал скручивать с openssl и darwinssl, но безуспешно.Моя ОС MacOS High Sierra.

Выходные данные valgrind:

valgrind ./demo 

==78893== Memcheck, a memory error detector
==78893== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==78893== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==78893== Command: ./demo
==78893== 
--78893-- run: /usr/bin/dsymutil "./demo" warning: no debug symbols in executable (-arch x86_64)
--78893-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option
--78893-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2 times)
--78893-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4 times)
--78893-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 8 times)
==78893== Thread 2:
==78893== Invalid read of size 4
==78893==    at 0x100AB45BA: _pthread_body (in /usr/lib/system/libsystem_pthread.dylib)
==78893==    by 0x100AB450C: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib)
==78893==    by 0x100AB3BF8: thread_start (in /usr/lib/system/libsystem_pthread.dylib)
==78893==  Address 0x18 is not stack'd, malloc'd or (recently) free'd
==78893== 
==78893== 
==78893== Process terminating with default action of signal 11 (SIGSEGV)
==78893==  Access not within mapped region at address 0x18
==78893==    at 0x100AB45BA: _pthread_body (in /usr/lib/system/libsystem_pthread.dylib)
==78893==    by 0x100AB450C: _pthread_start (in /usr/lib/system/libsystem_pthread.dylib)
==78893==    by 0x100AB3BF8: thread_start (in /usr/lib/system/libsystem_pthread.dylib)
==78893==  If you believe this happened as a result of a stack
==78893==  overflow in your program's main thread (unlikely but
==78893==  possible), you can try to increase the size of the
==78893==  main thread stack using the --main-stacksize= flag.
==78893==  The main thread stack size used in this run was 8388608.
==78893== 
==78893== HEAP SUMMARY:
==78893==     in use at exit: 840,095 bytes in 3,760 blocks
==78893==   total heap usage: 4,784 allocs, 1,024 frees, 1,520,703 bytes allocated
==78893== 
==78893== LEAK SUMMARY:
==78893==    definitely lost: 5,792 bytes in 78 blocks
==78893==    indirectly lost: 416 bytes in 12 blocks
==78893==      possibly lost: 4,648 bytes in 111 blocks
==78893==    still reachable: 208,644 bytes in 3,290 blocks
==78893==         suppressed: 620,595 bytes in 269 blocks
==78893== Rerun with --leak-check=full to see details of leaked memory
==78893== 
==78893== For counts of detected and suppressed errors, rerun with: -v
==78893== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 25 from 4) Segmentation fault: 11

Также вы можете попробовать написать в командной строке: "valgrind curl https://example.com" Это вызывает то же исключение.

...