Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jun 11, 2024
1 parent 450476d commit d367222
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
24 changes: 17 additions & 7 deletions libr/util/utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions test/db/cmd/cmd_iz
Original file line number Diff line number Diff line change
Expand Up @@ -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=<<EOF
7140 0x00087f8a 0x00489d8a 26 53 .text utf16le http://pomf.cat/upload.php
Expand Down

0 comments on commit d367222

Please sign in to comment.