Currently, asan does not detect unaligned partially OOB accesses:
int *x = new int[2]; // 8 bytes: [0,7].
int *u = (int*)((char*)x + 6);
*u = 1; // Access to range [6-9]
rnk's idea: mark the last 8 bytes with the shadow value '8' instead of '0'.
This will have two performance problems:
(minor) slow path will be taken more frequently for 1-, 2-, and 4-byte accesses
(major) 8-byte accesses will need slow path too (same for 16- and 32-byte accesses)
If we use larger shadow granularity (16:1 or 32:1 shadow) this will be less of a problem.
Anyway, this is something to try and evaluate.
Reported by konstantin.s.serebryany on 2012-08-13 17:52:39
Originally reported on Google Code with ID 101
Reported by
konstantin.s.serebryany
on 2012-08-13 17:52:39