1
0
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:
Joakim Hamren 2014-10-28 18:53:09 +01:00
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));
}