Issue #2645 - Return null if getName() PC is invalid.

This commit is contained in:
Moonchild 2024-10-21 22:27:57 +02:00 • committed by roytam1
commit e665b30629

View file

@ -1871,8 +1871,11 @@ class JSScript : public js::gc::TenuredCell
}
js::PropertyName* getName(jsbytecode* pc) const {
MOZ_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t)));
return getAtom(GET_UINT32_INDEX(pc))->asPropertyName();
if (containsPC(pc) && containsPC(pc + sizeof(uint32_t))) {
return getAtom(GET_UINT32_INDEX(pc))->asPropertyName();
} else {
return nullptr;
}
}
JSObject* getObject(size_t index) {