Commit 3a16ee87 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm][streaming] Report deterministic error location

This fixes a bug in the offset computation when instantiating the
decoder to decode a VarInt32.
It also extends the streaming decoder test to check the error location.

R=ahaas@chromium.org

Bug: v8:8814
Change-Id: Id8ce31ce7e494cce14231febbb5b0c7d91a26e01
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1505453Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60067}
parent 9584b6b0
......@@ -319,7 +319,8 @@ size_t StreamingDecoder::DecodeVarInt32::ReadBytes(
TRACE_STREAMING("ReadBytes of a VarInt\n");
memcpy(remaining_buf.start(), &bytes.first(), new_bytes);
buf.Truncate(offset() + new_bytes);
Decoder decoder(buf, streaming->module_offset());
Decoder decoder(buf,
streaming->module_offset() - static_cast<uint32_t>(offset()));
value_ = decoder.consume_u32v(field_name_);
// The number of bytes we actually needed to read.
DCHECK_GT(decoder.pc(), buffer().start());
......
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