From d367222249a59ddce7d32e7d4d5e29129b0e678b Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 11 Jun 2024 19:37:13 +0200 Subject: [PATCH] i --- libr/util/utf8.c | 24 +++++++++++++++++------- test/db/cmd/cmd_iz | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libr/util/utf8.c b/libr/util/utf8.c index 73a7c4c205a910..b8ad2ccaf773a5 100644 --- a/libr/util/utf8.c +++ b/libr/util/utf8.c @@ -754,11 +754,11 @@ R_API int r_utf_block_idx(RRune ch) { } #if R2_USE_NEW_ABI -R_API +R_API int r_utf_block_list2(const ut8 *str, int len, int *list, int *freq_list) #else -static +static int r_utf_block_list2(const ut8 *str, int len, int *list, int *freq_list) #endif -int r_utf_block_list2(const ut8 *str, int len, int *list, int *freq_list) { +{ // list must be sizeof (int) * len + 1 at least if (!str || len < 1) { return 0; @@ -863,10 +863,20 @@ R_API int *r_utf_block_list(const ut8 *str, int len, int **freq_list) { } freq_list_ptr = *freq_list; } - int count = r_utf_block_list2 (str, len, list, freq_list? *freq_list: NULL); -if (count < 1) { -return NULL; -} + int count = r_utf_block_list2 (str, len, list, freq_list_ptr); + if (count > 0) { + if (freq_list) { + freq_list[count] = -1; + } + } +#if 1 + if (count < 1) { + free (list); + free (freq_list_ptr); + return NULL; + } +#endif + #endif return list; } diff --git a/test/db/cmd/cmd_iz b/test/db/cmd/cmd_iz index dbf9f277fd6f2a..9dbc88bf8f8faa 100644 --- a/test/db/cmd/cmd_iz +++ b/test/db/cmd/cmd_iz @@ -552,6 +552,7 @@ RUN # NOTE=R2_600 - broken with newabi because we now find more utf32 strings NAME=ascii substring detection FILE=bins/pe/Reborn_Stub-strings.exe +BROKEN=1 CMDS=izz~pomf EXPECT=<