mirror of
https://github.com/ultrajson/ultrajson.git
synced 2024-11-23 12:32:02 +01:00
Fix to avoid a crash on bounds-check fail
This commit is contained in:
parent
0d76bd0849
commit
1af8acdd10
@ -448,7 +448,6 @@ FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_string ( struct DecoderState *ds)
|
||||
else
|
||||
{
|
||||
wchar_t *oldStart = ds->escStart;
|
||||
ds->escHeap = 1;
|
||||
if (newSize > (SIZE_MAX / sizeof(wchar_t)))
|
||||
{
|
||||
return SetError(ds, -1, "Could not reserve memory block");
|
||||
@ -458,6 +457,7 @@ FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_string ( struct DecoderState *ds)
|
||||
{
|
||||
return SetError(ds, -1, "Could not reserve memory block");
|
||||
}
|
||||
ds->escHeap = 1;
|
||||
memcpy(ds->escStart, oldStart, escLen * sizeof(wchar_t));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user