* [PATCH, applied] Bug 30959 - Crash on malformed fn call expression
@ 2023-10-11 12:02 Dodji Seketeli
0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2023-10-11 12:02 UTC (permalink / raw)
To: libabigail; +Cc: dodji
Hello,
The code fails to ignore a function call expression that is considered
malformed by the type suppression parser. Fixed thus.
* src/abg-suppression.cc
(type_suppression::insertion_range::eval_boundary): If the
function call expression is considered malformed, then do not
crash.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt:
New reference test output.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v{0,1}.c:
Source code of the new input binaries.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v{0,1}.o:
New input binaries.
* tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr:
New test suppression specification.
* tests/data/Makefile.am: Add the new test material above to the
source distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new tests to
this harness.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-suppression.cc | 9 +++++----
tests/data/Makefile.am | 6 ++++++
...-has-data-member-inserted-at-1-report-1.txt | 17 +++++++++++++++++
.../test-has-data-member-inserted-at-1-v0.c | 10 ++++++++++
.../test-has-data-member-inserted-at-1-v0.o | Bin 0 -> 3232 bytes
.../test-has-data-member-inserted-at-1-v1.c | 11 +++++++++++
.../test-has-data-member-inserted-at-1-v1.o | Bin 0 -> 3240 bytes
.../test-has-data-member-inserted-at-1.1.suppr | 3 +++
tests/test-diff-suppr.cc | 10 ++++++++++
9 files changed, 62 insertions(+), 4 deletions(-)
create mode 100644 tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt
create mode 100644 tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.c
create mode 100644 tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.o
create mode 100644 tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.c
create mode 100644 tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.o
create mode 100644 tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr
diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index 26d19217..254d6ae4 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -1468,10 +1468,11 @@ type_suppression::insertion_range::eval_boundary(const boundary_sptr boundary,
else if (fn_call_expr_boundary_sptr b = is_fn_call_expr_boundary(boundary))
{
ini::function_call_expr_sptr fn_call = b->as_function_call_expr();
- if ((fn_call->get_name() == "offset_of"
- || fn_call->get_name() == "offset_after"
- || fn_call->get_name() == "offset_of_first_data_member_regexp"
- || fn_call->get_name() == "offset_of_last_data_member_regexp")
+ if (fn_call
+ && (fn_call->get_name() == "offset_of"
+ || fn_call->get_name() == "offset_after"
+ || fn_call->get_name() == "offset_of_first_data_member_regexp"
+ || fn_call->get_name() == "offset_of_last_data_member_regexp")
&& fn_call->get_arguments().size() == 1)
{
if (fn_call->get_name() == "offset_of"
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 0569af34..7b07236e 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -1880,6 +1880,12 @@ test-diff-suppr/test-has-data-member-inserted-between-1-v3.o \
test-diff-suppr/test-has-data-member-inserted-between-1-v4.c \
test-diff-suppr/test-has-data-member-inserted-between-1-v4.o \
test-diff-suppr/test-has-data-member-inserted-between-1.suppr \
+test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt \
+test-diff-suppr/test-has-data-member-inserted-at-1-v0.c \
+test-diff-suppr/test-has-data-member-inserted-at-1-v0.o \
+test-diff-suppr/test-has-data-member-inserted-at-1-v1.c \
+test-diff-suppr/test-has-data-member-inserted-at-1-v1.o \
+test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr \
\
test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1 \
test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi \
diff --git a/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt
new file mode 100644
index 00000000..d0fac818
--- /dev/null
+++ b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt
@@ -0,0 +1,17 @@
+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-has-data-member-inserted-at-1-v1.c:3: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)
+
diff --git a/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.c b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.c
new file mode 100644
index 00000000..237d0d06
--- /dev/null
+++ b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.c
@@ -0,0 +1,10 @@
+struct foo
+{
+ char p[8];
+};
+
+int
+main(void)
+{
+ return 0;
+}
diff --git a/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.o b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..fb70318ec911a4d03502aa82ecd02d37eba4863b
GIT binary patch
literal 3232
zcmcgu&2Jl35TECbW4GJ5NnAlgK-r?AHi);5Lsddcicv(<P}EkHDnunPYx~(=@UG47
zI!el+NJt<A2M!!L^uUEPm)^N>LY(*ykT{kz2bfvUbGI*BH3Er|_RY+1KHsN(_szF2
z7lZ&!0xrQrO``z!N)P2mDmLH*RN>Z@FMq#J`g=cpfnyOwnY028&(V-2JEK_L;SkC~
zl(!L_8G*1;2~)g}z&rTO(on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v{P2CtKnA=9^sw!Hcy
zuKxkYQhj>Y%=#n5D5vfd#gu;GLSJiuxvsDICy3|8-{#Bx;0f_`KJwz<;saTGLj1QJ
zZ@9s}d7#-r_pSYZ;P^-0BE&xB_zmsIT(6&ozegc&{eR{4*XNYhpMLFhyvC^?vo=C-
qpX>LzVfr1SUr{rj_B3y*4&NUa?O8JCPkrUZ|H1wLm<>kRjQ<BUj2Q?3
literal 0
HcmV?d00001
diff --git a/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.c b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.c
new file mode 100644
index 00000000..d0ddcd2e
--- /dev/null
+++ b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.c
@@ -0,0 +1,11 @@
+struct foo
+{
+ int x;
+ char p[4];
+};
+
+int
+main(void)
+{
+ return 0;
+}
diff --git a/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.o b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.o
new file mode 100644
index 0000000000000000000000000000000000000000..e85c3aa0e6f1a146a66698bb2c86fb6dcd7f74e2
GIT binary patch
literal 3240
zcmcgu&2Jl35TEC@W4CVHBu3CQplm8olZsu}rYa#N#VDdpR0OD^f*z1r+t2nEdu?{t
zQ5p^iApsQ}df>=`0|z*B;fTbAKcP2H+{2jzomtOwUSGCq1QJhrJ2StTc{A^0#{Tq;
zH?L)c05t?$g+oc906*pr`Fg_E;VCG?t?he%{zCExzum`g4n%<@i$2fMM;}E^$aaQ9
zC<sw_2SKq1R-PCTBghusLnaHkY|am2m<dqo;>^>>f=nSvB_n1~ge00Mh{Txy94d_X
z4#X^2g^d+)rT9v5r@W4u%=1tzUM*TBTx(vuP%0O#<)!6$v5=p82BVgRRVWrWisT^5
zxFI&jI5R@*lnKkPz)rb>YZY90ZP6-Ctj{m*lxdmznf*mf;zgVp%4U*c!qG=1HwBov
zfi#D<7mx}e{w~cDp{u}&%yM!o8L^x>Jy|yK%LzC!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0
HcmV?d00001
diff --git a/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr
new file mode 100644
index 00000000..49ae2f76
--- /dev/null
+++ b/tests/data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr
@@ -0,0 +1,3 @@
+[suppress_type]
+ type_kind = struct
+ has_data_member_inserted_at = offset_of_first_data_member_regexp(.*foo[0-9]?$)
diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc
index 11be9b9a..19db440b 100644
--- a/tests/test-diff-suppr.cc
+++ b/tests/test-diff-suppr.cc
@@ -2256,6 +2256,16 @@ InOutSpec in_out_specs[] =
"data/test-diff-suppr/test-has-data-member-inserted-between-1-report-4.txt",
"output/test-diff-suppr/test-has-data-member-inserted-between-1-report-4.txt"
},
+ {
+ "data/test-diff-suppr/test-has-data-member-inserted-at-1-v0.o",
+ "data/test-diff-suppr/test-has-data-member-inserted-at-1-v1.o",
+ "",
+ "",
+ "data/test-diff-suppr/test-has-data-member-inserted-at-1.1.suppr",
+ "--drop-private-types --no-default-suppression --non-reachable-types",
+ "data/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt",
+ "output/test-diff-suppr/test-has-data-member-inserted-at-1-report-1.txt"
+ },
// This should be the last entry
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
};
--
2.39.3
--
Dodji
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-11 12:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11 12:02 [PATCH, applied] Bug 30959 - Crash on malformed fn call expression Dodji Seketeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).