forked from M-Labs/artiq
1
0
Fork 0

runtime/artiq_personality.c: don't dereference nonexistent typeInfoPtr.

This commit is contained in:
whitequark 2015-12-31 21:16:18 +08:00
parent 51e966edf2
commit f9e90d90fa
1 changed files with 12 additions and 10 deletions

View File

@ -415,17 +415,19 @@ _Unwind_Reason_Code __artiq_personality(
(void*)typeInfoOffset, (void*)actionOffset); (void*)typeInfoOffset, (void*)actionOffset);
EH_ASSERT((typeInfoOffset >= 0) && "Filter clauses are not supported"); EH_ASSERT((typeInfoOffset >= 0) && "Filter clauses are not supported");
unsigned encodingSize = getEncodingSize(ttypeEncoding); if(typeInfoOffset > 0) {
const uint8_t *typeInfoPtrPtr = classInfo - typeInfoOffset * encodingSize; unsigned encodingSize = getEncodingSize(ttypeEncoding);
uintptr_t typeInfoPtr = readEncodedPointer(&typeInfoPtrPtr, ttypeEncoding); const uint8_t *typeInfoPtrPtr = classInfo - typeInfoOffset * encodingSize;
EH_LOG("encodingSize=%u typeInfoPtrPtr=%p typeInfoPtr=%p", uintptr_t typeInfoPtr = readEncodedPointer(&typeInfoPtrPtr, ttypeEncoding);
encodingSize, typeInfoPtrPtr, (void*)typeInfoPtr); EH_LOG("encodingSize=%u typeInfoPtrPtr=%p typeInfoPtr=%p",
EH_LOG("typeInfo=%s", (char*)typeInfoPtr); encodingSize, typeInfoPtrPtr, (void*)typeInfoPtr);
EH_LOG("typeInfo=%s", (char*)typeInfoPtr);
if(typeInfoPtr == 0 || !strcmp(inflight->artiq.typeinfo, typeInfoPtr)) { if(typeInfoPtr == 0 || !strcmp(inflight->artiq.typeinfo, typeInfoPtr)) {
EH_LOG0("matching action found"); EH_LOG0("matching action found");
exceptionMatched = 1; exceptionMatched = 1;
break; break;
}
} }
if (!actionOffset) if (!actionOffset)