From 4d3811681a80f92a53e795f6a64c4b0fc2c8dd22 Mon Sep 17 00:00:00 2001 From: Khairulmizam Samsudin Date: Tue, 17 Mar 2020 00:03:22 +0800 Subject: [PATCH] Fix segfault in adf (#16230) --- libr/core/cmd_anal.c | 4 ++-- test/new/db/anal/x86_32 | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 80cdb2f0155ac..777764644e599 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -9235,12 +9235,12 @@ static int cmd_anal_all(RCore *core, const char *input) { } static bool anal_fcn_data (RCore *core, const char *input) { - RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, core->offset, -1); - ut32 fcn_size = r_anal_function_size_from_entry (fcn); + RAnalFunction *fcn = r_anal_get_fcn_in (core->anal, core->offset, R_ANAL_FCN_TYPE_ANY); if (fcn) { int i; bool gap = false; ut64 gap_addr = UT64_MAX; + ut32 fcn_size = r_anal_function_size_from_entry (fcn); char *bitmap = calloc (1, fcn_size); if (bitmap) { RAnalBlock *b; diff --git a/test/new/db/anal/x86_32 b/test/new/db/anal/x86_32 index d6ead6b38d7d1..6c16d5b03ecb1 100644 --- a/test/new/db/anal/x86_32 +++ b/test/new/db/anal/x86_32 @@ -257,6 +257,14 @@ EOF CMDS=aa ; s sym.fastcaslled ; afc fastcall ; afva ; ?e ; pdf~arg,var RUN +NAME=adf bug #16215 +FILE=- +EXPECT=<