Skip to content

wasm: fix R2R generic dictionary size-check off-by-one - #129984

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-r2r-dict-sizecheck-offbyone
Jun 29, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:wasm-r2r-dict-sizecheck-offbyone

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

We need to expand the dictionary when size <= slot offset, not size < slot offset.

The size-check stubs used a strict less-than, so a slot exactly at the
dictionary boundary skipped expansion and read past the slots. Use <= to
match genericdict.cpp, the interpreter, and the other targets.

Co-authored-by: Copilot <[email protected]>
@AndyAyersMS

Copy link
Copy Markdown
Member Author

Fixes a few pri-1 test failures.

@davidwrighton PTAL

Copilot AI 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.

Pull request overview

This PR fixes the WASM portable-entrypoint generic dictionary size-check to treat size == slotOffset as out-of-range, ensuring the lookup falls back to the helper path when the dictionary isn’t large enough for the requested slot.

Changes:

  • Update the class generic dictionary lookup size check from < to <= before performing the final indirection.
  • Update the method generic dictionary lookup size check from < to <= before performing the final indirection.

@AndyAyersMS
AndyAyersMS merged commit 422a449 into dotnet:main Jun 29, 2026
54 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jun 30, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
We need to expand the dictionary when size <= slot offset, not size <
slot offset.

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants