From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2510 invoked by alias); 25 Mar 2014 05:08:13 -0000 Mailing-List: contact glibc-bugs-regex-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-regex-owner@sourceware.org Received: (qmail 2471 invoked by uid 48); 25 Mar 2014 05:08:09 -0000 From: "octo.nebula at gmail dot com" To: glibc-bugs-regex@sourceware.org Subject: [Bug regex/16749] New: segfault in regfree Date: Tue, 25 Mar 2014 05:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: regex X-Bugzilla-Version: 2.19 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: octo.nebula at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-03/txt/msg00000.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16749 Bug ID: 16749 Summary: segfault in regfree Product: glibc Version: 2.19 Status: NEW Severity: critical Priority: P2 Component: regex Assignee: unassigned at sourceware dot org Reporter: octo.nebula at gmail dot com CC: drepper.fsp at gmail dot com When I run this sample program: #include #include int main() { regex_t regex; regmatch_t matches[3]; int status; status = regcomp(®ex, "(ello)", REG_EXTENDED); if (status != 0) { fprintf(stderr, "invalid regex\n"); return 1; } status = regexec(®ex, "Hello, world!", sizeof matches, matches, 0); if (status != 0) fprintf(stderr, "Match failed\n"); else printf("Matched range is %d,%d\n", matches[1].rm_so, matches[1].rm_eo); regfree(®ex); return 0; } And compile with: gcc -g3 -Wall -Wextra -ore re.c With gdb I get the SIGSEGV on regfree(): (gdb) run Starting program: /home/sun/source/re Matched range is 1,5 Program received signal SIGSEGV, Segmentation fault. 0xb7ecd0a9 in free_dfa_content () from /usr/lib/libc.so.6 (gdb) bt #0 0xb7ecd0a9 in free_dfa_content () from /usr/lib/libc.so.6 #1 0xb7ed8b2f in regfree () from /usr/lib/libc.so.6 #2 0x0804864f in main () at re.c:23 There is nothing wrong with the regex match, as you can see it succeeds without any problems. What is the problem with regfree? -- You are receiving this mail because: You are on the CC list for the bug.