This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12078] New: regcomp with invalid expression leaks memory
- From: "ppluzhnikov at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 1 Oct 2010 12:45:43 -0000
- Subject: [Bug libc/12078] New: regcomp with invalid expression leaks memory
- Reply-to: sourceware-bugzilla at sourceware dot org
Running attached test case under Valgrind shows that failing regcomp leaks
memory (also verified with alternative leak detector):
==21485== Memcheck, a memory error detector
==21485== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==21485== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
==21485== Command: ./a.out
==21485==
Error 8 (expected)
==21485==
==21485== HEAP SUMMARY:
==21485== in use at exit: 32 bytes in 1 blocks
==21485== total heap usage: 9 allocs, 8 frees, 3,474 bytes allocated
==21485==
==21485== 32 bytes in 1 blocks are definitely lost in loss record 1 of 1
==21485== at 0x4C24185: calloc
/tmp/vg/coregrind/m_replacemalloc/vg_replace_malloc.c:506
==21485== by 0x4EE5FA8: parse_expression
/usr/local/google/ppluzhnikov/Archive/glibc-git/posix/regcomp.c:3021
==21485== by 0x4EE791D: parse_branch
/usr/local/google/ppluzhnikov/Archive/glibc-git/posix/regcomp.c:2153
==21485== by 0x4EE7A0D: parse_reg_exp
/usr/local/google/ppluzhnikov/Archive/glibc-git/posix/regcomp.c:2112
==21485== by 0x4EE6C98: parse_expression
/usr/local/google/ppluzhnikov/Archive/glibc-git/posix/regcomp.c:2419
==21485== by 0x4EE795C: parse_branch
/usr/local/google/ppluzhnikov/Archive/glibc-git/posix/regcomp.c:2160
==21485== by 0x4EE7A0D: parse_reg_exp /usr/local/glibc-git/posix/regcomp.c:2112
==21485== by 0x4EE6C98: parse_expression
/usr/local/glibc-git/posix/regcomp.c:2419
==21485== by 0x4EE795C: parse_branch /usr/local/glibc-git/posix/regcomp.c:2160
==21485== by 0x4EE7A0D: parse_reg_exp /usr/local/glibc-git/posix/regcomp.c:2112
==21485== by 0x4EE7E20: re_compile_internal
/usr/local/glibc-git/posix/regcomp.c:2081
==21485== by 0x4EE9090: regcomp /usr/local/glibc-git/posix/regcomp.c:500
==21485==
==21485== LEAK SUMMARY:
==21485== definitely lost: 32 bytes in 1 blocks
==21485== indirectly lost: 0 bytes in 0 blocks
==21485== possibly lost: 0 bytes in 0 blocks
==21485== still reachable: 0 bytes in 0 blocks
==21485== suppressed: 0 bytes in 0 blocks
==21485==
==21485== For counts of detected and suppressed errors, rerun with: -v
==21485== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 0)
The bug is present in glibc-2.11.1 and current trunk; not present in glibc-2.7.
--
Summary: regcomp with invalid expression leaks memory
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper dot fsp at gmail dot com
ReportedBy: ppluzhnikov at google dot com
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=12078
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.