Commit ae2f476c authored by Andreas Haas's avatar Andreas Haas Committed by V8 LUCI CQ

[wasm] Improve error message in the streaming decoder

Bug: chromium:1213097
Change-Id: If768725a5645b7d21f59845692ca5491e8674bfa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2940896Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74964}
parent 89ec29a1
...@@ -462,7 +462,7 @@ class AsyncStreamingDecoder::DecodeFunctionLength : public DecodeVarInt32 { ...@@ -462,7 +462,7 @@ class AsyncStreamingDecoder::DecodeFunctionLength : public DecodeVarInt32 {
explicit DecodeFunctionLength(SectionBuffer* section_buffer, explicit DecodeFunctionLength(SectionBuffer* section_buffer,
size_t buffer_offset, size_t buffer_offset,
size_t num_remaining_functions) size_t num_remaining_functions)
: DecodeVarInt32(kV8MaxWasmFunctionSize, "body size"), : DecodeVarInt32(kV8MaxWasmFunctionSize, "function body size"),
section_buffer_(section_buffer), section_buffer_(section_buffer),
buffer_offset_(buffer_offset), buffer_offset_(buffer_offset),
// We are reading a new function, so one function less is remaining. // We are reading a new function, so one function less is remaining.
...@@ -549,8 +549,8 @@ AsyncStreamingDecoder::DecodeVarInt32::Next(AsyncStreamingDecoder* streaming) { ...@@ -549,8 +549,8 @@ AsyncStreamingDecoder::DecodeVarInt32::Next(AsyncStreamingDecoder* streaming) {
if (value_ > max_value_) { if (value_ > max_value_) {
std::ostringstream oss; std::ostringstream oss;
oss << "function size > maximum function size: " << value_ << " < " oss << "The value " << value_ << " for " << field_name_
<< max_value_; << " exceeds the maximum allowed value of " << max_value_;
return streaming->Error(oss.str()); return streaming->Error(oss.str());
} }
......
...@@ -62,7 +62,7 @@ function testErrorPosition(bytes, pos, message) { ...@@ -62,7 +62,7 @@ function testErrorPosition(bytes, pos, message) {
bytes.emit_u8(kTypeSectionCode); bytes.emit_u8(kTypeSectionCode);
bytes.emit_u32v(0xffffff23); bytes.emit_u32v(0xffffff23);
let pos = bytes.length - 1; let pos = bytes.length - 1;
testErrorPositionAsyncOnly(bytes, pos, 'maximum function size'); testErrorPositionAsyncOnly(bytes, pos, 'section length');
})(); })();
(function testFunctionsCountInvalidVarint() { (function testFunctionsCountInvalidVarint() {
...@@ -110,7 +110,7 @@ function testErrorPosition(bytes, pos, message) { ...@@ -110,7 +110,7 @@ function testErrorPosition(bytes, pos, message) {
bytes.emit_u32v(0xffffff23); bytes.emit_u32v(0xffffff23);
let pos = bytes.length - 1; let pos = bytes.length - 1;
testErrorPositionAsyncOnly(bytes, pos, 'maximum function size'); testErrorPositionAsyncOnly(bytes, pos, 'functions count');
})(); })();
(function testFunctionsCountDoesNotMatch() { (function testFunctionsCountDoesNotMatch() {
...@@ -163,7 +163,7 @@ function testErrorPosition(bytes, pos, message) { ...@@ -163,7 +163,7 @@ function testErrorPosition(bytes, pos, message) {
bytes.emit_bytes([0x80, 0x80, 0x80, 0x80, 0x80, 0x00]); bytes.emit_bytes([0x80, 0x80, 0x80, 0x80, 0x80, 0x00]);
let pos = bytes.length - 1 - 1; let pos = bytes.length - 1 - 1;
testErrorPositionAsyncOnly(bytes, pos, 'expected body size'); testErrorPositionAsyncOnly(bytes, pos, 'function body size');
})(); })();
(function testBodySizeTooBig() { (function testBodySizeTooBig() {
...@@ -192,7 +192,7 @@ function testErrorPosition(bytes, pos, message) { ...@@ -192,7 +192,7 @@ function testErrorPosition(bytes, pos, message) {
bytes.emit_u32v(0xffffff23); bytes.emit_u32v(0xffffff23);
let pos = bytes.length - 1; let pos = bytes.length - 1;
testErrorPositionAsyncOnly(bytes, pos, 'maximum function size'); testErrorPositionAsyncOnly(bytes, pos, 'function body size');
})(); })();
(function testBodySizeDoesNotFit() { (function testBodySizeDoesNotFit() {
......
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