diff --git a/libr/core/cmd_search.c b/libr/core/cmd_search.c index 4bf4cf3898..7d2207161a 100644 --- a/libr/core/cmd_search.c +++ b/libr/core/cmd_search.c @@ -4866,14 +4866,21 @@ again: eprintf ("Usage: /z min max\n"); break; } + const char *maxstr = NULL; if ((p = strchr (input + 2, ' '))) { *p = 0; - max = r_num_math (core->num, p + 1); + maxstr = r_str_trim_head_ro (p + 1); + max = r_num_math (core->num, maxstr); } else { eprintf ("Usage: /z min max\n"); break; } - min = r_num_math (core->num, input + 2); + const char *minstr = r_str_trim_head_ro (input + 2); + if ((maxstr && *maxstr == '-') || (minstr && *minstr == '-')) { + R_LOG_ERROR ("min and max must be positive"); + break; + } + min = r_num_math (core->num, minstr); if (!r_search_set_string_limits (core->search, min, max)) { R_LOG_ERROR ("min must be lower than max"); break; diff --git a/test/fuzz/fuzz_cmd.c b/test/fuzz/fuzz_cmd.c index f4ef1c8611..096fd24216 100644 --- a/test/fuzz/fuzz_cmd.c +++ b/test/fuzz/fuzz_cmd.c @@ -14,6 +14,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; } + r_core_cmd0 (r, "e scr.interactive=false"); // r_core_cmdf (r, "o malloc://%zu", Size); // r_io_write_at (r->io, 0, Data, Size); r_core_cmd0 (r, "o /bin/ls");