mirror of
https://github.com/json-c/json-c.git
synced 2026-03-23 23:19:06 +08:00
Fix CVE-2020-12762.
This commit is a squashed backport of the following commits on the master branch: *099016b7e8*77d935b7ae*d07b910149*519dfe1591*a59d5acfab*26f080997d
This commit is contained in:
@@ -136,6 +136,9 @@ int array_list_del_idx(struct array_list *arr, size_t idx, size_t count)
|
||||
{
|
||||
size_t i, stop;
|
||||
|
||||
/* Avoid overflow in calculation with large indices. */
|
||||
if (idx > SIZE_T_MAX - count)
|
||||
return -1;
|
||||
stop = idx + count;
|
||||
if (idx >= arr->length || stop > arr->length)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user