From 8fb26b919bf53891cb3bb90cdb9dc5660ded769c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Mon, 12 Mar 2018 17:54:00 +0100 Subject: [PATCH] VTable End on Reference --- libr/anal/vtable.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libr/anal/vtable.c b/libr/anal/vtable.c index f598e79d70..70e86a1d98 100644 --- a/libr/anal/vtable.c +++ b/libr/anal/vtable.c @@ -113,6 +113,7 @@ static bool vtable_section_can_contain_vtables(RVTableContext *context, RBinSect !strcmp(section->name, ".data.rel.ro"); } + static int vtable_is_addr_vtable_start(RVTableContext *context, ut64 curAddress) { RAnalRef *xref; RListIter *xrefIter; @@ -185,6 +186,11 @@ R_API RList *r_anal_vtable_search(RVTableContext *context) { while (vtable_is_value_in_text_section (context, startAddress)) { noOfMethods++; startAddress += context->word_size; + + // a ref means the vtable has ended + if (!r_list_empty (r_anal_xrefs_get (context->anal, startAddress))) { + break; + } } vtable->method_count = noOfMethods; r_list_append (vtables, vtable);