This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/36479] New: Short buffer in libcpp
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2008 17:03:02 -0000
- Subject: [Bug preprocessor/36479] New: Short buffer in libcpp
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
[hjl@gnu-6 prev-gcc]$ cat foo.ii
# 1 "/net/gnu-13/export/gnu/src/gcc/gcc/gcc/testsuite/g++.dg/pch/pch.C"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/net/gnu-13/export/gnu/src/gcc/gcc/gcc/testsuite/g++.dg/pch/pch.C"
int main()
{
return 0;
}
[hjl@gnu-6 prev-gcc]$ valgrind --tool=memcheck ./cc1plus -fpreprocessed foo.ii
-quiet -dumpbase foo.ii -m32 -mtune=generic -auxbase pch -O2 -version -o foo.s
==6304== Memcheck, a memory error detector.
==6304== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==6304== Using LibVEX rev 1804, a library for dynamic binary translation.
==6304== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==6304== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==6304== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==6304== For more details, rerun with: -v
==6304==
GNU C++ (GCC) version 4.4.0 20080609 (experimental) [trunk revision 136589]
(x86_64-unknown-linux-gnu)
compiled by GNU C version 4.4.0 20080609 (experimental) [trunk revision
136589], GMP version 4.2.2, MPFR version 2.3.0-p4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9e36edea0acfb287d81f6630c10d1047
==6304== Invalid read of size 1
==6304== at 0x4A07B24: strlen (mc_replace_strmem.c:242)
==6304== by 0x693EB2: output_file_directive (toplev.c:680)
==6304== by 0x7AE7E8: x86_file_start (i386.c:23343)
==6304== by 0x694DA4: toplev_main (toplev.c:1343)
==6304== by 0x39D3C1E329: (below main) (in /lib64/libc-2.8.so)
==6304== Address 0x4cb7d01 is 0 bytes after a block of size 65 alloc'd
==6304== at 0x4A074D1: realloc (vg_replace_malloc.c:429)
==6304== by 0xA0313C: xrealloc (xmalloc.c:179)
==6304== by 0x9D22AC: cpp_interpret_string (charset.c:1392)
==6304== by 0x9D2860: cpp_interpret_string_notranslate (charset.c:1416)
==6304== by 0x9D624A: do_linemarker (directives.c:956)
==6304== by 0x9D4BB4: _cpp_handle_directive (directives.c:483)
==6304== by 0x9DCE6E: cpp_read_main_file (init.c:536)
==6304== by 0x4D9947: c_common_post_options (c-opts.c:1174)
==6304== by 0x694309: toplev_main (toplev.c:1660)
==6304== by 0x39D3C1E329: (below main) (in /lib64/libc-2.8.so)
==6304==
==6304== Invalid read of size 1
==6304== at 0x693114: output_quoted_string (toplev.c:652)
==6304== by 0x693F03: output_file_directive (toplev.c:695)
==6304== by 0x7AE7E8: x86_file_start (i386.c:23343)
==6304== by 0x694DA4: toplev_main (toplev.c:1343)
==6304== by 0x39D3C1E329: (below main) (in /lib64/libc-2.8.so)
==6304== Address 0x4cb7d01 is 0 bytes after a block of size 65 alloc'd
==6304== at 0x4A074D1: realloc (vg_replace_malloc.c:429)
==6304== by 0xA0313C: xrealloc (xmalloc.c:179)
==6304== by 0x9D22AC: cpp_interpret_string (charset.c:1392)
==6304== by 0x9D2860: cpp_interpret_string_notranslate (charset.c:1416)
==6304== by 0x9D624A: do_linemarker (directives.c:956)
==6304== by 0x9D4BB4: _cpp_handle_directive (directives.c:483)
==6304== by 0x9DCE6E: cpp_read_main_file (init.c:536)
==6304== by 0x4D9947: c_common_post_options (c-opts.c:1174)
==6304== by 0x694309: toplev_main (toplev.c:1660)
==6304== by 0x39D3C1E329: (below main) (in /lib64/libc-2.8.so)
==6304==
==6304== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 1)
==6304== malloc/free: in use at exit: 448,374 bytes in 1,606 blocks.
==6304== malloc/free: 4,000 allocs, 2,394 frees, 2,176,191 bytes allocated.
==6304== For counts of detected errors, rerun with: -v
==6304== searching for pointers to 1,606 not-freed blocks.
==6304== checked 3,757,576 bytes.
==6304==
==6304== LEAK SUMMARY:
==6304== definitely lost: 8,832 bytes in 30 blocks.
==6304== possibly lost: 0 bytes in 0 blocks.
==6304== still reachable: 439,542 bytes in 1,576 blocks.
==6304== suppressed: 0 bytes in 0 blocks.
==6304== Rerun with --leak-check=full to see details of leaked memory.
[hjl@gnu-6 prev-gcc]$
--
Summary: Short buffer in libcpp
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36479