mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 13:02:28 +00:00
LibWasm: Error when parsed section lengths are invalidated
This commit is contained in:
parent
aee2f25929
commit
afd8d90f32
Notes:
sideshowbarker
2024-07-16 23:05:02 +09:00
Author: https://github.com/dzfrias
Commit: afd8d90f32
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/522
1 changed files with 2 additions and 4 deletions
|
@ -1413,10 +1413,8 @@ ParseResult<Module> Module::parse(Stream& stream)
|
||||||
return with_eof_check(stream, ParseError::InvalidModuleVersion);
|
return with_eof_check(stream, ParseError::InvalidModuleVersion);
|
||||||
|
|
||||||
Vector<AnySection> sections;
|
Vector<AnySection> sections;
|
||||||
for (;;) {
|
while (!stream.is_eof()) {
|
||||||
auto section_id_or_error = stream.read_value<u8>();
|
auto section_id_or_error = stream.read_value<u8>();
|
||||||
if (stream.is_eof())
|
|
||||||
break;
|
|
||||||
if (section_id_or_error.is_error())
|
if (section_id_or_error.is_error())
|
||||||
return with_eof_check(stream, ParseError::ExpectedIndex);
|
return with_eof_check(stream, ParseError::ExpectedIndex);
|
||||||
|
|
||||||
|
@ -1472,7 +1470,7 @@ ParseResult<Module> Module::parse(Stream& stream)
|
||||||
default:
|
default:
|
||||||
return with_eof_check(stream, ParseError::InvalidIndex);
|
return with_eof_check(stream, ParseError::InvalidIndex);
|
||||||
}
|
}
|
||||||
if (!section_stream.is_eof())
|
if (section_stream.remaining() != 0)
|
||||||
return ParseError::SectionSizeMismatch;
|
return ParseError::SectionSizeMismatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue