mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 16:21:29 +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: https://github.com/LadybirdBrowser/ladybird/commit/afd8d90f32 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/522
|
@ -1413,10 +1413,8 @@ ParseResult<Module> Module::parse(Stream& stream)
|
|||
return with_eof_check(stream, ParseError::InvalidModuleVersion);
|
||||
|
||||
Vector<AnySection> sections;
|
||||
for (;;) {
|
||||
while (!stream.is_eof()) {
|
||||
auto section_id_or_error = stream.read_value<u8>();
|
||||
if (stream.is_eof())
|
||||
break;
|
||||
if (section_id_or_error.is_error())
|
||||
return with_eof_check(stream, ParseError::ExpectedIndex);
|
||||
|
||||
|
@ -1472,7 +1470,7 @@ ParseResult<Module> Module::parse(Stream& stream)
|
|||
default:
|
||||
return with_eof_check(stream, ParseError::InvalidIndex);
|
||||
}
|
||||
if (!section_stream.is_eof())
|
||||
if (section_stream.remaining() != 0)
|
||||
return ParseError::SectionSizeMismatch;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue