From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6885 invoked by alias); 17 Apr 2014 22:19:59 -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 6845 invoked by uid 48); 17 Apr 2014 22:19:55 -0000 From: "nkennedy at grammatech dot com" To: glibc-bugs-regex@sourceware.org Subject: [Bug regex/16851] New: re_node_set_alloc should not return REG_ESPACE when size == 0 Date: Thu, 17 Apr 2014 22:19: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: unspecified X-Bugzilla-Keywords: std-isoc X-Bugzilla-Severity: normal X-Bugzilla-Who: nkennedy at grammatech 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 keywords 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-04/txt/msg00000.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16851 Bug ID: 16851 Summary: re_node_set_alloc should not return REG_ESPACE when size == 0 Product: glibc Version: unspecified Status: NEW Keywords: std-isoc Severity: normal Priority: P2 Component: regex Assignee: unassigned at sourceware dot org Reporter: nkennedy at grammatech dot com CC: drepper.fsp at gmail dot com, eggert at gnu dot org regcomp fails with REG_ESPACE from re_node_set_alloc if malloc(0) returns NULL. ptmalloc2 malloc(0) doesn't return NULL (unless it's really out of space), but this is allowed by the standard and causes errors when such an allocator is used. This was fixed in gnulib at bbf0d723ed2335add96bcc0f842885d8a5d8b6da: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=bbf0d723ed2335add96bcc0f842885d8a5d8b6da And previously in uClibc at 4af711dfe8caf18756c2cb28f72b102c5eba3930: http://git.opencores.org/?a=commitdiff&p=uClibc&h=4af711dfe8caf18756c2cb28f72b102c5eba3930 (Despite the commit message, the uClibc patch had not ultimately been applied to sed, rather until bbf0d72... gnulib's regex worked around the error using the malloc-gnu wrapper module.) In the vein of harmonizing glibc/gnulib regex, I'm don't think adding the MALLOC_0_IS_NONNULL macro attempting to check for malloc(0) failure is needed. It should be enough to add "&& size != 0" to regex_internal.c:972 if (BE (set->elems == NULL, 0)) -- You are receiving this mail because: You are on the CC list for the bug.