mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 609063 diagnostic: check for concurrent slots realloc, r=dvander, a=beta8+
This commit is contained in:
parent
f50fdd538d
commit
9894ece070
@ -3763,9 +3763,16 @@ JSObject::growSlots(JSContext *cx, size_t newcap)
|
|||||||
if (!hasSlotsArray())
|
if (!hasSlotsArray())
|
||||||
return allocSlots(cx, actualCapacity);
|
return allocSlots(cx, actualCapacity);
|
||||||
|
|
||||||
|
Value *oldslots = slots;
|
||||||
Value *tmpslots = (Value*) cx->realloc(slots, actualCapacity * sizeof(Value));
|
Value *tmpslots = (Value*) cx->realloc(slots, actualCapacity * sizeof(Value));
|
||||||
if (!tmpslots)
|
if (!tmpslots)
|
||||||
return false; /* Leave dslots as its old size. */
|
return false; /* Leave dslots as its old size. */
|
||||||
|
// If slots has changed, that means some other thread changed it while we
|
||||||
|
// were realloc'ing, which is very bad.
|
||||||
|
#define JS_CRASH(addr) *(int *) addr = 0;
|
||||||
|
if (oldslots != slots)
|
||||||
|
JS_CRASH(0xf0);
|
||||||
|
#undef JS_CRASH
|
||||||
slots = tmpslots;
|
slots = tmpslots;
|
||||||
capacity = actualCapacity;
|
capacity = actualCapacity;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user