Merge pull request #971 from prownd/json_tokener-arraylist-assorted-cleanups-s01

json_tokener, arraylist: assorted cleanups
This commit is contained in:
Eric Hawicz authored and GitHub committed 2026-09-14 23:14:06 -04:00
commit a559871165
2 files changed
+5 -2

No files matched your search

+4 -1
View File
@@ -83,7 +83,10 @@ static int array_list_expand_internal(struct array_list *arr, size_t max)
void *t;
size_t new_size;
if (max < arr->size)
/* The array can already hold max entries when max == arr->size, since
* the caller only ever indexes up to max - 1.
*/
if (max <= arr->size)
return 0;
/* Avoid undefined behaviour on size_t overflow */
if (arr->size >= SIZE_T_MAX / 2)
+1 -1
View File
@@ -1157,7 +1157,7 @@ struct json_object *json_tokener_parse_ex(struct json_tokener *tok, const char *
}
if (numuint64 <= INT64_MAX)
{
num64 = (uint64_t)numuint64;
num64 = (int64_t)numuint64;
current = json_object_new_int64(num64);
if (current == NULL)
{