From 0d13a70896f6d353c9fb8e6caa16624296e9c6e7 Mon Sep 17 00:00:00 2001 From: nganhkhoa Date: Fri, 2 Jun 2023 12:03:27 +0700 Subject: [PATCH] fix trie walk now able to search for symbol with multiple name with same prefix --- research/custom_loader/b.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/research/custom_loader/b.cc b/research/custom_loader/b.cc index dfc36b4..003abd1 100644 --- a/research/custom_loader/b.cc +++ b/research/custom_loader/b.cc @@ -319,13 +319,12 @@ void *find_in_export_trie(const void *header, void *trie, const char *symbol) { // terminal node will have data uint32_t data_count = 0; decode_uleb128(ptr, &data_count); - if (data_count != 0) { + if (data_count != 0 && *find == 0) { // printf("reached terminal node\n"); - if (*find != 0) { - // it reaches terminal node but symbol is not fully scanned - return 0; - } break; + } else if (data_count) { + // still need to follow the branch + ptr += data_count; } char num_child = ptr[0]; ptr++;