From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 13A6E3858C54; Tue, 10 Oct 2023 16:43:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13A6E3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1696956221; bh=8PvVWVkAWqQQZGPRPkaZrbBsvmCYwvDMx+6s2D1N3XI=; h=From:To:Subject:Date:From; b=yM6QvOYvbpi5MLDdp7fQTJ8zNl2MI21c+j/KN6wD9hyGKWzuZhl3+KRFiK2FrIRn8 wlbKC7Nb8V31/BVgdlmroC3x5PM433k+WUT0TY5nYth97Ahe8cvn1fZZaqS/oNOKEO AEJiGj+TwuS3w315cbJDvgf6ktUI9s+cCy4ReC5c= From: "quic_johmoo at quicinc dot com" To: libabigail@sourceware.org Subject: [Bug default/30959] New: abidiff segfault with certain regex patterns Date: Tue, 10 Oct 2023 16:43:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: libabigail X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: quic_johmoo at quicinc dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dodji at redhat dot com 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 target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30959 Bug ID: 30959 Summary: abidiff segfault with certain regex patterns Product: libabigail Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: default Assignee: dodji at redhat dot com Reporter: quic_johmoo at quicinc dot com CC: libabigail at sourceware dot org Target Milestone: --- Created attachment 15162 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D15162&action=3Ded= it GDB backtrace When using a regular expression with range-matching in suppressions, abidiff segfaults with a null dereference. To reproduce, create a few binaries that have a diff in a structure, but ke= ep the same size: % cat test_1.c struct foo { char p[8]; }; int main(void) { return 0; } % cat test_2.c struct foo { int x; char p[4]; }; int main(void) { return 0; } % gcc -g -fno-eliminate-unused-debug-types -o test_1.o test_1.c % gcc -g -fno-eliminate-unused-debug-types -o test_2.o test_2.c Then create the following suppression file (suppr.txt): [suppress_type] type_kind =3D struct has_data_member_inserted_at =3D offset_of_first_data_member_regexp(.*foo[0-9]?$) Then, run: % abidiff --suppr suppr.txt -t test_1.o test_2.o [1] 16928 segmentation fault abidiff --suppr suppr.txt -t test_1.o test= _2.o It appears to be related to the range-matching pattern in the regular expression. If I change the suppressions file to be and equivalent (using \d instead of [0-9]): [suppress_type] type_kind =3D struct has_data_member_inserted_at =3D offset_of_first_data_member_regexp(.*foo\= d?$) ...abidiff works correctly: % abidiff --suppr suppr.txt -t test_1.o test_2.o Functions changes summary: 0 Removed, 0 Changed, 0 Added function Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Unreachable types summary: 0 removed, 1 changed, 0 added type 1 changed type unreachable from any public interface: [C] 'struct foo' changed: type size hasn't changed 1 data member insertion: 'int x', at offset 0 (in bits) at test_2.c:2:1 1 data member change: type of 'char p[8]' changed: type name changed from 'char[8]' to 'char[4]' array type size changed from 64 to 32 array type subrange 1 changed length from 8 to 4 and offset changed from 0 to 32 (in bits) (by +32 bits) I've attached a GDB backtrace I captured in the failure case. All I can gather is that in the failure case, the following line in abg-suppression.cc is returning a NULL fn_call. ini::function_call_expr_sptr fn_call =3D b->as_function_call_expr(); --=20 You are receiving this mail because: You are on the CC list for the bug.=