|
From: <sv...@va...> - 2009-05-11 11:33:20
|
Author: sewardj
Date: 2009-05-11 12:33:09 +0100 (Mon, 11 May 2009)
New Revision: 9835
Log:
Make this test actually generate a SysParam error. It didn't
previously because writing to an fd of -1 got pre-failed by m_syswrap,
and so the tool never got a chance to check the param write(buf).
Modified:
branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.c
branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.stderr.exp
Modified: branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.c
===================================================================
--- branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.c 2009-05-11 08:21:52 UTC (rev 9834)
+++ branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.c 2009-05-11 11:33:09 UTC (rev 9835)
@@ -8,12 +8,12 @@
int main(void)
{
- int i = 11;
+ int i = 11; int fd = open("/dev/null", O_WRONLY);
char* buf = malloc(sizeof(char) * 6);
char c = buf[-1]; // LoadStoreErr
char* x = buf + (long)buf; // ArithErr
char* y = (char*)((long)buf * i); // AsmErr
- write(-1, buf+3, 5); // SysParamErr
-
+ write(fd, buf+3, 5); // SysParamErr
+ close(fd);
return x-y+c;
}
Modified: branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.stderr.exp
===================================================================
--- branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.stderr.exp 2009-05-11 08:21:52 UTC (rev 9834)
+++ branches/MESSAGING_TIDYUP/exp-ptrcheck/tests/supp.stderr.exp 2009-05-11 11:33:09 UTC (rev 9835)
@@ -1,4 +1,10 @@
-Warning: invalid file descriptor -1 in syscall write()
+Syscall param write(buf) is non-contiguous
+ at 0x........: write (in /...libc...)
+ by 0x........: main (supp.c:16)
+ First byte (0x........) is 3 bytes inside a 6-byte block alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (supp.c:12)
+ Last byte is not inside a known block
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
|