Skip to content

fix(reader): reject oversize heap vectors without panicking - #179

Open
VedantMadane wants to merge 1 commit into
nasa:mainfrom
VedantMadane:fix/issue-158
Open

fix(reader): reject oversize heap vectors without panicking#179
VedantMadane wants to merge 1 commit into
nasa:mainfrom
VedantMadane:fix/issue-158

Conversation

@VedantMadane

Copy link
Copy Markdown

Summary

fix(reader): reject oversize heap vectors without panicking

Changes

  • reader.rs: return VecTooLong when Layout::array fails before alloc
  • decode-errors.wast: unbounded type-section length regression

Fixes #158

- reader.rs: return VecTooLong when Layout::array fails before alloc
- decode-errors.wast: unbounded type-section length regression

Fixes nasa#158

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly

@github-actions

Copy link
Copy Markdown

CoreMark Benchmark Results

Current Score: 248.221
Baseline Score (main): 246.225
Difference: +1.996 (0.81%)

@Kronos3 Kronos3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Looks like some tests are failing! Also one minor nit

Comment thread src/reader.rs
Comment on lines +468 to +470
// Reject lengths that cannot form a valid allocation layout. On 32-bit
// targets Layout::array overflows for huge declared lengths and used to
// panic inside Vec::new_in; return VecTooLong like the stack path (#158).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these comments, I'd rather avoid superfluous comments explaining self document code. The regression test comments are good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Malformed module panics the decoder on 32-bit targets: unbounded vector length reaches Layout::array(..).unwrap()

2 participants