This is a simplified test case for this question on Stack Overflow.
Created
January 20, 2015 15:54
-
-
Save Keith-S-Thompson/723cf727f4f5c1a11481 to your computer and use it in GitHub Desktop.
Simplified test case for http://stackoverflow.com/q/28046944/827263
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char test1[4]; | |
char test2[4]; | |
char test3[8]; | |
int main() | |
{ | |
snprintf(test3, sizeof(test3), "%s %s", test1, test2); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /etc/os-release | |
NAME="Ubuntu" | |
VERSION="14.04.1 LTS, Trusty Tahr" | |
ID=ubuntu | |
ID_LIKE=debian | |
PRETTY_NAME="Ubuntu 14.04.1 LTS" | |
VERSION_ID="14.04" | |
HOME_URL="http://www.ubuntu.com/" | |
SUPPORT_URL="http://help.ubuntu.com/" | |
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" | |
$ uname -a | |
Linux bomb20 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux | |
$ g++ --version | |
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2 | |
Copyright (C) 2013 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
$ valgrind --version | |
valgrind-3.10.0.SVN | |
$ g++ -g example.cpp -o example && valgrind --tool=exp-sgcheck ./example | |
==16916== exp-sgcheck, a stack and global array overrun detector | |
==16916== NOTE: This is an Experimental-Class Valgrind Tool | |
==16916== Copyright (C) 2003-2013, and GNU GPL'd, by OpenWorks Ltd et al. | |
==16916== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info | |
==16916== Command: ./example | |
==16916== | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
--16916-- warning: evaluate_Dwarf3_Expr: unhandled DW_OP_ 0x93 | |
==16916== Invalid read of size 1 | |
==16916== at 0x4E7BA03: vfprintf (vfprintf.c:1661) | |
==16916== by 0x4EA3108: vsnprintf (vsnprintf.c:119) | |
==16916== by 0x4E84531: snprintf (snprintf.c:33) | |
==16916== by 0x400564: main (example.cpp:9) | |
==16916== Address 0x601045 expected vs actual: | |
==16916== Expected: global array "test1" of size 4 in object with soname "NONE" | |
==16916== Actual: global array "test2" of size 4 in object with soname "NONE" | |
==16916== Actual: is 0 after Expected | |
==16916== | |
==16916== | |
==16916== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment