gopalshankar / address-sanitizer

Automatically exported from code.google.com/p/address-sanitizer
0 stars 0 forks source link

ASan reports sometimes contain incorrect statements #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
#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.

Original issue reported on code.google.com by euge...@google.com on 5 Feb 2013 at 11:43

GoogleCodeExporter 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? 

Original comment by konstant...@gmail.com on 5 Feb 2013 at 11:50

GoogleCodeExporter 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?

Original comment by euge...@google.com on 5 Feb 2013 at 11:53

GoogleCodeExporter 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").

Original comment by euge...@google.com on 5 Feb 2013 at 11:54

GoogleCodeExporter commented 9 years ago
SGTM

Original comment by konstant...@gmail.com on 5 Feb 2013 at 11:55

GoogleCodeExporter 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

Original comment by timurrrr@google.com on 5 Feb 2013 at 11:55

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

I'm going to implement a).

Original comment by euge...@google.com on 5 Feb 2013 at 12:02

GoogleCodeExporter commented 9 years ago
r174373.

Original comment by euge...@google.com on 5 Feb 2013 at 2:32