mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
core options, runahead: check three small allocations
core_option_manager_parse_variable and _parse_option wrote each value's hash through an unchecked malloc; a failure now fails that option, as the functions' other failures do. runahead_input_state_set_last read input_state_list->size after mylist_create could leave it NULL; it now returns. Not reproduced: needs a failing allocator. Closes #19838
This commit is contained in:
1 parent
81a5ff5f1e
commit
c88fc9b66e
2 files changed
+8
No files matched your search
@@ -724,6 +724,9 @@ static bool core_option_manager_parse_variable(
|
||||
const char *value_label = core_option_manager_parse_value_label(
|
||||
value, NULL);
|
||||
|
||||
if (!value_hash)
|
||||
goto error;
|
||||
|
||||
/* Set value hash */
|
||||
*value_hash = core_option_manager_hash_string(value);
|
||||
option->vals->elems[i].userdata = (void*)value_hash;
|
||||
@@ -1001,6 +1004,9 @@ static bool core_option_manager_parse_option(
|
||||
uint32_t *value_hash = (uint32_t *)malloc(sizeof(uint32_t));
|
||||
const char *value_label = values[i].label;
|
||||
|
||||
if (!value_hash)
|
||||
return false;
|
||||
|
||||
/* Append value string
|
||||
* > We know that 'value' is always valid */
|
||||
string_list_append(option->vals, value, attr);
|
||||
|
||||
@@ -1395,6 +1395,8 @@ static void runahead_input_state_set_last(
|
||||
mylist_create(&runloop_st->input_state_list, 16,
|
||||
input_list_element_constructor,
|
||||
input_list_element_destructor);
|
||||
if (!runloop_st->input_state_list)
|
||||
return;
|
||||
|
||||
/* Find list item */
|
||||
for (i = 0; i < (unsigned)runloop_st->input_state_list->size; i++)
|
||||
|
||||
Reference in new issue
Block a user