mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 02:23:58 +00:00
Fix rvector assert when indexing empty ones ##r2r
* Crashing when passing corrupted tests to r2r
This commit is contained in:
parent
12adbeedbe
commit
1a40fef85c
@ -237,6 +237,7 @@ R_API RPVector *r2r_load_cmd_test_file(const char *file) {
|
||||
#undef DO_KEY_NUM
|
||||
|
||||
R_LOG_ERROR (LINEFMT ": Unknown key \"%s\"", file, linenum, line);
|
||||
break;
|
||||
} while ((line = nextline));
|
||||
beach:
|
||||
free (contents);
|
||||
|
@ -158,6 +158,9 @@ R_API void *r_vector_insert(RVector *vec, size_t index, void *x) {
|
||||
|
||||
R_API void *r_vector_insert_range(RVector *vec, size_t index, void *first, size_t count) {
|
||||
r_return_val_if_fail (vec && index <= vec->len, NULL);
|
||||
if (count < 1) {
|
||||
return NULL;
|
||||
}
|
||||
if (vec->len + count > vec->capacity) {
|
||||
RESIZE_OR_RETURN_NULL (R_MAX (NEXT_VECTOR_CAPACITY, vec->len + count));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user