Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[interpreter] Binary decoder rejects heap type indices >= 2^31 as malformed

Aperta
#2,289 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
67/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
wasm

Direzione di ricerca

Start in interpreter/binary/decode.ml at the s33 decoding path around line 108, then compare how it handles the provided boundary indices 2^31 and 2^31 - 1. Run the interpreter against the included assert_invalid module and check the reported error. Done means 2^31 is decoded as a well-formed index and the module reports "unknown type" rather than "integer representation too long".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A heap type index is any non-negative s33:

https://github.com/WebAssembly/spec/blob/340650f2f620169685814774bc5b019d05d4d3d7/specification/wasm-3.0/5.2-binary.types.spectec#L30-L32

So an index of 2^31 or 2^32 - 1 is well-formed, and a module using it is invalid (unknown type), not malformed. The decoder wraps the s33 to a signed 32-bit integer first and reports "integer representation too long":

https://github.com/WebAssembly/spec/blob/340650f2f620169685814774bc5b019d05d4d3d7/interpreter/binary/decode.ml#L108

;; (type (func (param (ref null 2147483648))))
(assert_invalid
  (module binary "\00asm" "\01\00\00\00"
    "\01\0a\01\60\01\63\80\80\80\80\08\00")
  "unknown type")

The interpreter fails this with integer representation too long. Index 2^31 - 1 (\ff\ff\ff\ff\07) is reported as "unknown type" as expected.

Tested at 340650f.

Lingua principale
WebAssembly
Stelle
3.5k
Fork
540
Merge medio
1g 4h
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di WebAssembly/spec

Tutte le issue di WebAssembly/spec

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.