Azure / azure-c-shared-utility

Azure C SDKs common code
Other
111 stars 203 forks source link

Fix for crash in case AddOptionInternal fails adding xio CONCRETE_OPTIONS #529

Closed ewertons closed 3 years ago

ewertons commented 3 years ago

This crash occurs for the following callstack:

==31911== Invalid read of size 8 ==31911== at 0x144C04: DestroyInternal (optionhandler.c:111) ==31911== by 0x14517F: OptionHandler_Destroy (optionhandler.c:278) ==31911== by 0x144958: xio_retrieveoptions (xio.c:288) ==31911== by 0x140395: tlsio_openssl_retrieveoptions (tlsio_openssl.c:335) ==31911== by 0x14488B: xio_retrieveoptions (xio.c:276) ==31911== by 0x14F12C: ResetConnectionIfNecessary (iothubtransport_mqtt_common.c:1977) ==31911== by 0x15074B: UpdateMqttConnectionStateIfNeeded (iothubtransport_mqtt_common.c:2585) ==31911== by 0x15290C: IoTHubTransport_MQTT_Common_DoWork (iothubtransport_mqtt_common.c:3474) ==31911== by 0x14AD63: IoTHubTransportMqtt_DoWork (iothubtransportmqtt.c:121) ==31911== by 0x11DD46: IoTHubClientCore_LL_DoWork (iothub_client_core_ll.c:2123) ==31911== by 0x128F92: ScheduleWork_Thread (iothub_client_core.c:813) ==31911== by 0x1397D0: ThreadWrapper (threadapi_pthreads.c:35) ==31911== Address 0x6097008 is 24 bytes inside a block of size 32 free'd ==31911== at 0x48369AB: free (vg_replace_malloc.c:530) ==31911== by 0x144C98: DestroyInternal (optionhandler.c:123) ==31911== by 0x14517F: OptionHandler_Destroy (optionhandler.c:278) ==31911== by 0x14473A: xio_DestroyOption (xio.c:246) ==31911== by 0x144BD0: AddOptionInternal (optionhandler.c:91) ==31911== by 0x144FA6: OptionHandler_AddOption (optionhandler.c:219) ==31911== by 0x144907: xio_retrieveoptions (xio.c:285) ==31911== by 0x140395: tlsio_openssl_retrieveoptions (tlsio_openssl.c:335) ==31911== by 0x14488B: xio_retrieveoptions (xio.c:276) ==31911== by 0x14F12C: ResetConnectionIfNecessary (iothubtransport_mqtt_common.c:1977) ==31911== by 0x15074B: UpdateMqttConnectionStateIfNeeded (iothubtransport_mqtt_common.c:2585) ==31911== by 0x15290C: IoTHubTransport_MQTT_Common_DoWork (iothubtransport_mqtt_common.c:3474) ==31911== Block was alloc'd at ==31911== at 0x483577F: malloc (vg_replace_malloc.c:299) ==31911== by 0x144990: CreateInternal (optionhandler.c:28) ==31911== by 0x144D37: OptionHandler_Create (optionhandler.c:142) ==31911== by 0x14543E: socketio_retrieveoptions (socketio_berkeley.c:178) ==31911== by 0x14488B: xio_retrieveoptions (xio.c:276) ==31911== by 0x140395: tlsio_openssl_retrieveoptions (tlsio_openssl.c:335) ==31911== by 0x14488B: xio_retrieveoptions (xio.c:276) ==31911== by 0x14F12C: ResetConnectionIfNecessary (iothubtransport_mqtt_common.c:1977) ==31911== by 0x15074B: UpdateMqttConnectionStateIfNeeded (iothubtransport_mqtt_common.c:2585) ==31911== by 0x15290C: IoTHubTransport_MQTT_Common_DoWork (iothubtransport_mqtt_common.c:3474) ==31911== by 0x14AD63: IoTHubTransportMqtt_DoWork (iothubtransportmqtt.c:121) ==31911== by 0x11DD46: IoTHubClientCore_LL_DoWork (iothub_client_core_ll.c:2123)

ericwolz commented 3 years ago

36 - xio_ut (SEGFAULT)