mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-26 01:08:39 +09:00
Security fixes toward 71 version.
Security fixes toward 71 version.
This commit is contained in:
parent
af10b8035e
commit
6c6e0c524c
1 changed files with 11 additions and 19 deletions
|
|
@ -720,21 +720,9 @@ CodeGenerator::visitFunctionDispatch(LFunctionDispatch* lir)
|
|||
{
|
||||
MFunctionDispatch* mir = lir->mir();
|
||||
Register input = ToRegister(lir->input());
|
||||
Label* lastLabel;
|
||||
size_t casesWithFallback;
|
||||
|
||||
// Determine if the last case is fallback or an ordinary case.
|
||||
if (!mir->hasFallback()) {
|
||||
MOZ_ASSERT(mir->numCases() > 0);
|
||||
casesWithFallback = mir->numCases();
|
||||
lastLabel = skipTrivialBlocks(mir->getCaseBlock(mir->numCases() - 1))->lir()->label();
|
||||
} else {
|
||||
casesWithFallback = mir->numCases() + 1;
|
||||
lastLabel = skipTrivialBlocks(mir->getFallback())->lir()->label();
|
||||
}
|
||||
|
||||
// Compare function pointers, except for the last case.
|
||||
for (size_t i = 0; i < casesWithFallback - 1; i++) {
|
||||
|
||||
// Compare function pointers
|
||||
for (size_t i = 0; i < mir->numCases(); i++) {
|
||||
MOZ_ASSERT(i < mir->numCases());
|
||||
LBlock* target = skipTrivialBlocks(mir->getCaseBlock(i))->lir();
|
||||
if (ObjectGroup* funcGroup = mir->getCaseObjectGroup(i)) {
|
||||
|
|
@ -746,8 +734,14 @@ CodeGenerator::visitFunctionDispatch(LFunctionDispatch* lir)
|
|||
}
|
||||
}
|
||||
|
||||
// Jump to the last case.
|
||||
masm.jump(lastLabel);
|
||||
// If at the end, and we have a fallback, we can jump to the fallback block.
|
||||
if (mir->hasFallback()) {
|
||||
masm.jump(skipTrivialBlocks(mir->getFallback())->lir()->label());
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, crash.
|
||||
masm.assumeUnreachable("Did not match input function!");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -790,13 +784,11 @@ CodeGenerator::visitObjectGroupDispatch(LObjectGroupDispatch* lir)
|
|||
|
||||
if (!mir->hasFallback()) {
|
||||
MOZ_ASSERT(lastBranch.isInitialized());
|
||||
#ifdef DEBUG
|
||||
Label ok;
|
||||
lastBranch.relink(&ok);
|
||||
lastBranch.emit(masm);
|
||||
masm.assumeUnreachable("Unexpected ObjectGroup");
|
||||
masm.bind(&ok);
|
||||
#endif
|
||||
if (!isNextBlock(lastBlock))
|
||||
masm.jump(lastBlock->label());
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue