Open ZQ-Struggle opened 2 years ago
The bug is in the JS_GetOwnPropertyNamesInternal
function: we use max_int
in
atom_count = num_keys_count + str_keys_count + sym_keys_count + exotic_keys_count;
/* avoid allocating 0 bytes */
tab_atom = js_malloc(ctx, sizeof(tab_atom[0]) * max_int(atom_count, 1));
atom_count
is greater than INT_MAX
so the size allocated for the property names is just 1, leading to a segmentation fault when storing the atoms.
There are multiple instances of similar bugs elsewhere when the number of properties potentially exceed INT_MAX
.
I am scanning the code to fix these and will post an updated version later this week.
Chqrlie.
This bug will be fixed shortly, along with other similar issues caused by arithmetic overflow computing allocation sizes and such.
Write on an unknown address bug report
The reproduce js code is shown in follow:
The code is generated by a js engine fuzzer. This vulnerability may be exploited to cause rce.