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

View File

@ -415,6 +415,7 @@ _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");
if(typeInfoOffset > 0) {
unsigned encodingSize = getEncodingSize(ttypeEncoding); unsigned encodingSize = getEncodingSize(ttypeEncoding);
const uint8_t *typeInfoPtrPtr = classInfo - typeInfoOffset * encodingSize; const uint8_t *typeInfoPtrPtr = classInfo - typeInfoOffset * encodingSize;
uintptr_t typeInfoPtr = readEncodedPointer(&typeInfoPtrPtr, ttypeEncoding); uintptr_t typeInfoPtr = readEncodedPointer(&typeInfoPtrPtr, ttypeEncoding);
@ -427,6 +428,7 @@ _Unwind_Reason_Code __artiq_personality(
exceptionMatched = 1; exceptionMatched = 1;
break; break;
} }
}
if (!actionOffset) if (!actionOffset)
break; break;