Commit 6e452a1c authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[cleanup][wasm] Use early return in validation of FunctionIndexImmediate

R=clemensb@chromium.org

Bug: v8:10155
Change-Id: Ia89724ed5f8af4199bbce41ed12a0dace578c43f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2069326Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66428}
parent fc2f00d3
......@@ -1133,13 +1133,12 @@ class WasmDecoder : public Decoder {
}
inline bool Validate(const byte* pc, FunctionIndexImmediate<validate>& imm) {
if (!VALIDATE(module_ != nullptr &&
imm.index < module_->functions.size())) {
if (!module_) return true;
if (!VALIDATE(imm.index < module_->functions.size())) {
errorf(pc, "invalid function index: %u", imm.index);
return false;
}
if (!VALIDATE(module_ != nullptr &&
module_->functions[imm.index].declared)) {
if (!VALIDATE(module_->functions[imm.index].declared)) {
this->errorf(pc, "undeclared reference to function #%u", imm.index);
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment