google / google/sanitizers

find unaligned partially OOB accesses

Open
#100 12 comments 0 reactions 1 assignee Claimed by @kcc View on GitHub
Performance Priority-Medium ProjectAddressSanitizer Status-Accepted Type-Enhancement
Dominant language
C
Stars
12.5k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Originally reported on Google Code with ID 100

```
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:49:58

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.