Skip to contentSkip to conversation

Memory corruption with long filenames

DISCUSSION Vegard Nossum 1 participant 1 message May 25, 2008 Sparse checker

lore
Share & tools
lore
#0 lore raw

Hi,

Running sparse with this single line as the input file:

#include "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

(yes, that's exactly 257 "x"es)

gives me this peculiar message:

crash.c:1:10: error: unable to open 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/usr/lib/gcc/i386-redhat-linux/4.1.2/include/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/'

Running it under valgrind gives a bit more info:

==15582== Source and destination overlap in memcpy(0x80A1BC0, 0x80A1AC0, 257)

==15582==    at 0x4024116: memcpy (mc_replace_strmem.c:116)
==15582==    by 0x8078E07: try_include (pre-process.c:713)
==15582==    by 0x807B6F7: handle_include_path (pre-process.c:732)
==15582==    by 0x807A476: preprocess (pre-process.c:1682)
==15582==    by 0x804EB70: sparse_tokenstream (lib.c:751)
==15582==    by 0x804FC1D: sparse (lib.c:878)
==15582==    by 0x804A613: main (sparse.c:606)

But I don't know how to best fix this, so I'm simply posting the report here.

Thanks :-)

Vegard