I got a null pointer access in the network server:
[2020-11-04 07:33:50.626,940] [NWK_MGR/MAIN] INFO : [MUTEX] Unlock SRSP Mutex [2020-11-04 07:33:51] nwkmgrservices.c:483:9: runtime error: member access within null pointer of type 'struct sNwkMgrDb_DeviceInfo_t' [2020-11-04 07:33:51] SUMMARY: AddressSanitizer: undefined-behavior nwkmgrservices.c:483 [2020-11-04 07:33:51] ASAN:SIGSEGV [2020-11-04 07:33:51] ================================================================= [2020-11-04 07:33:51] ==791==ERROR: AddressSanitizer: SEGV on unknown address 0x00000008 (pc 0x00065c98 bp 0xbea7b8d8 sp 0xbea7b568 T0) [2020-11-04 07:33:51] #0 0x65c97 in zNwkSrv_TimerCallback .../3rdparty/ti/Zigbee_3_0_Linux_Gateway_1_0_1/source/Projects/zstack/linux/nwkmgr/nwkmgrservices.c:483 [2020-11-04 07:33:51] #1 0x65387 in zNwkSrv_UpdateTimers .../3rdparty/ti/Zigbee_3_0_Linux_Gateway_1_0_1/source/Projects/zstack/linux/nwkmgr/nwkmgrservices.c:419 [2020-11-04 07:33:51] #2 0x45065 in timerHandler .../3rdparty/ti/Zigbee_3_0_Linux_Gateway_1_0_1/source/Projects/zstack/linux/nwkmgr/nwkmgrsrv.c:886 [2020-11-04 07:33:51] #3 0xb6d65a5f (/lib/libc.so.6+0x2ca5f) [2020-11-04 07:33:51] #4 0xb6f41043 in pause (/lib/libpthread.so.0+0x11043) [2020-11-04 07:33:51] #5 0x54bd9 in getUserInput .../3rdparty/ti/Zigbee_3_0_Linux_Gateway_1_0_1/source/Projects/zstack/linux/nwkmgr/nwkmgrsrv.c:5170 [2020-11-04 07:33:51] #6 0x44063 in appMain .../3rdparty/ti/Zigbee_3_0_Linux_Gateway_1_0_1/source/Projects/zstack/linux/nwkmgr/nwkmgrsrv.c:610 [2020-11-04 07:33:51] #7 0x9a075 in main ../srvwrapper/main.c:182 [2020-11-04 07:33:51] #8 0xb6d4fcf7 in __libc_start_main (/lib/libc.so.6+0x16cf7) [2020-11-04 07:33:51] [2020-11-04 07:33:51] AddressSanitizer can not provide additional info. [2020-11-04 07:33:51] SUMMARY: AddressSanitizer: SEGV .../3rdparty/ti/Zigbee_3_0_Linux_Gateway_1_0_1/source/Projects/zstack/linux/nwkmgr/nwkmgrservices.c:483 zNwkSrv_TimerCallback [2020-11-04 07:33:51] ==791==ABORTING
This happens in the call to sendSipleDesReq:
static void zNwkSrv_TimerCallback( zNwkSrv_AD_StateMachine_t *pState )
[...]
case zNwkSrv_AD_State_GettingSimpleDesc_c:
sendUnicastRouteReq( pState->pDeviceInfo->nwkAddr );
sendSimpleDescReq( pState->pDeviceInfo->nwkAddr, pState->pDeviceInfo->aEndpoint[pState->ep].endpointId );
break;
Given that the segmentation fault is generated on the access to address 0x00000008, we can determine from the struct sNwkMgrDb_DeviceInfo_t that the access to pState->pDeviceInfo->nwkAddr is causing this. (The message designates sNwkMgrDb_DeviceInfo_t , not zNwkSrv_AD_StateMachine_t where pDeviceInfo is likely also at zNwkSrv_AD_StateMachine_t ).
However, line 482 has the same parameter. Either the report is offset by 1 line, or pState was modified in the mean time. This source file was not changed.
sendUnicastRouteReq does not seem to impact pState.
What could be causing this null pointer?
