4 ms·
You can use the pointer as an object id, but only for living objects. The pointer becomes invalid the moment the memory is freed. Your bug was that you used an
by jackewiehose 6y ago
You can use the pointer as an object id, but only for living objects.
The pointer becomes invalid the moment the memory is freed. Your bug
was that you used an invalid pointer.
- Matt3o12_ 6y agoBut doesn't this feature exactly help with this bug? Two memory allocations should now return different pointers (because the MTE nibble is different) therefore the comparision should fail. Unless ofcourse the application was using this undefined behavior (which would be very buggy since malloc can randomly refuse to reuse the same address even though it was freed and therefore create extremely hard and difficult to track bugs).
- flohofwoe 6y ago> Your bug was that you used an invalid pointer. Exactly, but just declaring that a pointer is "invalid" doesn't help much with debugging such dangling pointer problems, while tagged pointers do. It's not like an "invalid pointer" is any different from a "valid pointer" when you look at it. With the extra tag bits, an invalid pointer can actually be identified as such.