mirror of
git://sourceware.org/git/libabigail.git
synced 2025-02-22 16:56:57 +00:00
Bug 30959 - Crash on malformed fn call expression
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>
This commit is contained in:
parent
bb89dbb085
commit
efb1841252
@ -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"
|
||||
|
@ -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 \
|
||||
|
@ -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)
|
||||
|
@ -0,0 +1,10 @@
|
||||
struct foo
|
||||
{
|
||||
char p[8];
|
||||
};
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
struct foo
|
||||
{
|
||||
int x;
|
||||
char p[4];
|
||||
};
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
[suppress_type]
|
||||
type_kind = struct
|
||||
has_data_member_inserted_at = offset_of_first_data_member_regexp(.*foo[0-9]?$)
|
@ -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}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user