ramosian-glider / sanitizers

0 stars 0 forks source link

ASan reports sometimes contain incorrect statements #151

Closed ramosian-glider closed 9 years ago

ramosian-glider commented 9 years ago

Originally reported on Google Code with ID 150

#include <cstdio>
#include <cstdlib>

int main()
{
  int* q = (int*)malloc(102);
  return q[25];
}

ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60260000aff4 at pc 0x418199
bp 0x7fff42614a30 sp 0x7fff42614a28
READ of size 4 at 0x60260000aff4 thread T0
...
0x60260000aff4 is located 0 bytes to the right of 102-byte region [0x60260000af90,0x60260000aff6)

^ The last line is not true.

Reported by eugenis@google.com on 2013-02-05 11:43:54

ramosian-glider commented 9 years ago
yea, that's a bit wrong. 
How do you suggest to change the output in a way that will not break our users' scripts?

Reported by konstantin.s.serebryany on 2013-02-05 11:50:03

ramosian-glider commented 9 years ago
Just change the address in the last line to the first unaddressable location inside
the access range.

Will that break anything?

Reported by eugenis@google.com on 2013-02-05 11:53:43

ramosian-glider commented 9 years ago
This actually came from looking at ASAN_ACCESS_RANGE. Everything going though that reports
access sizes of 1. Even scanf("%d").

Reported by eugenis@google.com on 2013-02-05 11:54:49

ramosian-glider commented 9 years ago
SGTM

Reported by konstantin.s.serebryany on 2013-02-05 11:55:13

ramosian-glider commented 9 years ago
How about:
a) 0x60260000aff6 is located 0 bytes to the right of 102-byte region [0x60260000af90,0x60260000aff6)

b) 0x60260000aff4 goes out of the 102-byte region [0x60260000af90,0x60260000aff6) bounds

Reported by timurrrr@google.com on 2013-02-05 11:55:29

ramosian-glider commented 9 years ago
b is too large of a change, can break report parsers.

I'm going to implement a).

Reported by eugenis@google.com on 2013-02-05 12:02:39

ramosian-glider commented 9 years ago
r174373.

Reported by eugenis@google.com on 2013-02-05 14:32:36

ramosian-glider commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:13:40