mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
Bug 794214 - Avoid putting poisoned pointer into type->newScript. r=billm
--HG-- extra : rebase_source : 904806c6059409c1af02624a1b4b989329f5acf3
This commit is contained in:
parent
4ac3852d87
commit
9d0d41cb98
@ -4958,7 +4958,17 @@ CheckNewScriptProperties(JSContext *cx, HandleTypeObject type, JSFunction *fun)
|
||||
|
||||
size_t numBytes = sizeof(TypeNewScript)
|
||||
+ (initializerList.length() * sizeof(TypeNewScript::Initializer));
|
||||
#ifdef JSGC_ROOT_ANALYSIS
|
||||
// calloc can legitimately return a pointer that appears to be poisoned.
|
||||
void *p;
|
||||
do {
|
||||
p = cx->calloc_(numBytes);
|
||||
} while (IsPoisonedPtr(p));
|
||||
type->newScript = (TypeNewScript *) p;
|
||||
#else
|
||||
type->newScript = (TypeNewScript *) cx->calloc_(numBytes);
|
||||
#endif
|
||||
|
||||
if (!type->newScript) {
|
||||
cx->compartment->types.setPendingNukeTypes(cx);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user