зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1797685 - wasm: Fix validation condition in decodeDelegate. r=jseward
Differential Revision: https://phabricator.services.mozilla.com/D161087
This commit is contained in:
Родитель
80078e3ba1
Коммит
3b826f2d65
|
@ -1631,21 +1631,21 @@ inline bool OpIter<Policy>::readDelegate(uint32_t* relativeDepth,
|
|||
ValueVector* tryResults) {
|
||||
MOZ_ASSERT(Classify(op_) == OpKind::Delegate);
|
||||
|
||||
uint32_t originalDepth;
|
||||
if (!readVarU32(&originalDepth)) {
|
||||
return fail("unable to read delegate depth");
|
||||
}
|
||||
|
||||
Control& block = controlStack_.back();
|
||||
if (block.kind() != LabelKind::Try) {
|
||||
return fail("delegate can only be used within a try");
|
||||
}
|
||||
|
||||
uint32_t delegateDepth;
|
||||
if (!readVarU32(&delegateDepth)) {
|
||||
return fail("unable to read delegate depth");
|
||||
}
|
||||
|
||||
// Depths for delegate start counting in the surrounding block.
|
||||
*relativeDepth = originalDepth + 1;
|
||||
if (*relativeDepth >= controlStack_.length()) {
|
||||
if (delegateDepth >= controlStack_.length() - 1) {
|
||||
return fail("delegate depth exceeds current nesting level");
|
||||
}
|
||||
*relativeDepth = delegateDepth + 1;
|
||||
|
||||
// Because `delegate` acts like `end` and ends the block, we will check
|
||||
// the stack here.
|
||||
|
|
Загрузка…
Ссылка в новой задаче