[wasm][eh] Add missing checks before using EH opcodes

R=clemensb@chromium.org

Bug: v8:8091
Change-Id: Id2f0b4635ee235c592a969a41d1f50ed677150f2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2667857
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72490}
This commit is contained in:
Thibaud Michaud 2021-02-02 16:35:11 +01:00 committed by Commit Bot
parent 910d92e227
commit ef3e9cb059

View File

@ -2538,6 +2538,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
}
DECODE(Delegate) {
CHECK_PROTOTYPE_OPCODE(eh);
BranchDepthImmediate<validate> imm(this, this->pc_ + 1);
// -1 because the current try block is not included in the count.
if (!this->Validate(this->pc_ + 1, imm, control_depth() - 1)) return 0;
@ -2566,6 +2567,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
}
DECODE(CatchAll) {
CHECK_PROTOTYPE_OPCODE(eh);
if (!VALIDATE(!control_.empty())) {
this->error("catch-all does not match any try");
return 0;