@@ -226,24 +226,26 @@ __tysan_check(void *addr, int size, tysan_type_descriptor *td, int flags) {
226
226
OldTDPtr -= i;
227
227
OldTD = *OldTDPtr;
228
228
229
- // When shadow memory is set for global objects, the entire object is tagged with the struct type
230
- // This means that when you access a member variable, tysan reads that as you accessing a struct midway
231
- // through, with 'i' being the offset
232
- // Therefore, if you are accessing a struct, we need to find the member type. We can go through the
233
- // members of the struct type and see if there is a member at the offset you are accessing the struct by.
234
- // If there is indeed a member starting at offset 'i' in the struct, we should check aliasing legality
235
- // with that type. If there isn't, we run alias checking on the struct with will give us the correct error.
236
- tysan_type_descriptor *InternalMember = OldTD;
229
+ // When shadow memory is set for global objects, the entire object is tagged
230
+ // with the struct type This means that when you access a member variable,
231
+ // tysan reads that as you accessing a struct midway through, with 'i' being
232
+ // the offset Therefore, if you are accessing a struct, we need to find the
233
+ // member type. We can go through the members of the struct type and see if
234
+ // there is a member at the offset you are accessing the struct by. If there
235
+ // is indeed a member starting at offset 'i' in the struct, we should check
236
+ // aliasing legality with that type. If there isn't, we run alias checking
237
+ // on the struct which will give us the correct error.
238
+ tysan_type_descriptor *AccessedType = OldTD;
237
239
if (OldTD->Tag == TYSAN_STRUCT_TD) {
238
- for (int j = 0 ; j < OldTD->Struct .MemberCount ; j++ ) {
240
+ for (int j = 0 ; j < OldTD->Struct .MemberCount ; ++j ) {
239
241
if (OldTD->Struct .Members [j].Offset == i) {
240
- InternalMember = OldTD->Struct .Members [j].Type ;
242
+ AccessedType = OldTD->Struct .Members [j].Type ;
241
243
break ;
242
244
}
243
245
}
244
246
}
245
247
246
- if (!isAliasingLegal (td, InternalMember , i))
248
+ if (!isAliasingLegal (td, AccessedType , i))
247
249
reportError (addr, size, td, OldTD, AccessStr,
248
250
" accesses part of an existing object" , -i, pc, bp, sp);
249
251
0 commit comments