mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 00:57:30 +09:00
Bug 1743515 - Add dynamic check for valid serialized length. r=jonco, a=RyanVM
This commit is contained in:
parent
e3fb994063
commit
2ceec8871e
1 changed files with 5 additions and 0 deletions
|
|
@ -545,6 +545,11 @@ ReadStructuredClone(JSContext* cx, JSStructuredCloneData& data,
|
||||||
JS::StructuredCloneScope scope, MutableHandleValue vp,
|
JS::StructuredCloneScope scope, MutableHandleValue vp,
|
||||||
const JSStructuredCloneCallbacks* cb, void* cbClosure)
|
const JSStructuredCloneCallbacks* cb, void* cbClosure)
|
||||||
{
|
{
|
||||||
|
if (data.Size() % 8) {
|
||||||
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||||
|
JSMSG_SC_BAD_SERIALIZED_DATA, "misaligned");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
SCInput in(cx, data);
|
SCInput in(cx, data);
|
||||||
JSStructuredCloneReader r(in, scope, cb, cbClosure);
|
JSStructuredCloneReader r(in, scope, cb, cbClosure);
|
||||||
return r.read(vp);
|
return r.read(vp);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue