UintNumberType.serialize silently wraps out-of-range values (negative, NaN, overflow)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- backend-api-design
Direzione di ricerca
Start with the UintNumberType.serialize and value_serializeToBytes paths named in the issue, then compare their range handling with the deserialize guard from #564. Check the corresponding UintBigintType.serialize path as well. Done means out-of-range values are rejected as described; an open linked pull request, #573, is already addressing this issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
UintNumberType.serialize / value_serializeToBytes writes through DataView setters with no range check. Out-of-range JS numbers are truncated or wrapped into valid-looking uint bytes instead of throwing.
#564 tightened the deserialize path for values above Number.MAX_SAFE_INTEGER. The serialize path still accepts negatives, non-integers, NaN, and values >= 2^(8*byteLength).
SSZ uintN is [0, 2^N - 1]. Silent wrap means hashTreeRoot / encoding can succeed with the wrong root when a caller passes a bad number.
Version
@chainsafe/[email protected]
Steps to reproduce
import { UintNumberType } from "@chainsafe/ssz";
const u8 = new UintNumberType(1);
const u64 = new UintNumberType(8);
console.log(Array.from(u8.serialize(-1))); // [255]
console.log(Array.from(u8.serialize(256))); // [0]
console.log(Array.from(u8.serialize(1.9))); // [1]
console.log(Array.from(u8.serialize(NaN))); // [0]
console.log(Array.from(u64.serialize(-1))); // [255,255,255,255,0,0,0,0]
UintBigintType.serialize has the same wrap behavior for negatives and values past the bit width (for example new UintBigintType(1).serialize(256n) → [0]).
Expected behaviour
Serialize should reject values outside the uint domain (negative, non-integer, NaN, +/-Infinity unless clipInfinity, and >= 2^(8*byteLength)), similar in spirit to the deserialize guard from #564.
Actual behaviour
Serialize succeeds and emits wrapped / truncated bytes. Callers get a plausible encoding with no error.
- Lingua principale
- TypeScript
- Stelle
- 62
- Fork
- 30
- Merge medio
- 4h 37m
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ChainSafe/ssz
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
ListBasicType.serialize accepts values longer than the list limitForse già presa @kutluhaneth46 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ChainSafe/ssz#575 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
BitList deserialization with reuseBytes: true mutates the input bufferForse già presa @yinbowen-dc l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ChainSafe/ssz#559 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bitlist maxSize off by one and inconsistent progressive list default limitsForse già presa @yinbowen-dc l’ha presa 10 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ChainSafe/ssz#548 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
SSZ Union Deserialization Vulnerable to Trailing Data for Certain VariantsForse già presa @shadowzzed l’ha presa 80 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ChainSafe/ssz
Issue simili
-
Release utils decode git output chunk by chunk, so a multi-byte character can turn into U+FFFDForse già presa @goranai l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 2 giorni
-
Task retarget keeps the old host in task scope and adds the new host in a form that matches nothingForse già presa @chaitanya0305 l’ha presa oggi. Apertabug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
BaaRai/ARTEX#652 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
compiler-explorer/compiler-explorer#9710 ·
I maintainer di solito rispondono entro 1 giorno
-
test(web): RevealArtwork's warm tests flake on CI because a 0 ms idle timeout means no deadlineApertabug effort:S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nightscout/nocturne#4556 ·
I maintainer di solito rispondono entro 1 giorno
-
sumHorizontal, maxHorizontal, minHorizontal, allHorizontal, anyHorizontal, struct and argSortBy treat strings as literals instead of column namesForse già presa @tomaionescu l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pola-rs/nodejs-polars#486 ·
I maintainer di solito rispondono entro 1 giorno