@std/encoding: decodeAscii85 corrupts delimited data ending in "<", decodeVarint32 reads past the end of the buffer
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- deno, typescript
Direzione di ricerca
Read encoding/ascii85.ts and encoding/varint.ts, focusing on the delimiter removal and the decodeVarint32 loop and bounds checks described in the issue. Run the reproduction with Deno, then add or run focused tests for both cases. Done means delimited ASCII85 round trips when the payload ends in <, and malformed, truncated, or overflowing 32-bit varints throw RangeError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
decodeAscii85does not round tripencodeAscii85(data, { delimiter: true })when the encoded payload ends in<: the last byte comes back wrong.decodeVarint32accepts truncated input and returns an offset past the end of the buffer, reads a 6th byte, and returns values above0xffffffff.decodeVarintthrows aRangeErroron the same truncated input.
Steps to Reproduce
import { decodeAscii85, encodeAscii85 } from "jsr:@std/[email protected]/ascii85";
import { decodeVarint, decodeVarint32 } from "jsr:@std/[email protected]/varint";
const encoded = encodeAscii85(new Uint8Array([0xc6, 0x91, 0xeb, 0x81]), { delimiter: true });
console.log(encoded, decodeAscii85(encoded));
console.log(decodeVarint32(new Uint8Array([0x80])));
console.log(decodeVarint32(new Uint8Array([0xff, 0xff])));
console.log(decodeVarint32(new Uint8Array([0x80, 0x80, 0x80, 0x80, 0x80, 0x01])));
console.log(decodeVarint32(new Uint8Array([0xff, 0xff, 0xff, 0xff, 0x7f])));
try { console.log(decodeVarint(new Uint8Array([0x80]))); } catch (e) { console.log(String(e)); }
deno run repro.ts
Expected behavior
The first line ends with Uint8Array(4) [ 198, 145, 235, 129 ]. The four decodeVarint32 calls throw RangeError like decodeVarint (truncated, 6 bytes, and above 32 bits).
Actual behavior
<~`f]S<~> Uint8Array(4) [ 198, 145, 235, 131 ]
[ 0, 2 ]
[ 16383, 3 ]
[ 34359738368, 6 ]
[ 34359738367, 5 ]
RangeError: Cannot decode the varint input: Malformed or overflow varint
In encoding/ascii85.ts, replaceAll(/(<~|~>)/g, "") matches the payload's trailing < plus the ~ of the closing ~>, leaving a stray >. In encoding/varint.ts, decodeVarint32 loops with i <= Math.min(buf.length, offset + MaxVarintLen32) instead of <, and never checks the 32-bit bound.
Environment
- OS: Debian 12 (x86_64)
- deno version: 2.9.8
- std version: @std/encoding 1.0.11, also
mainat f834d02
Credit: https://ucsbplse.github.io/
- Lingua principale
- TypeScript
- Stelle
- 3.6k
- Fork
- 713
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la 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 denoland/std
-
`assertEquals` throws on structurally equal `Error` objects due to different stack traceForse già presa @powerman2026 l’ha presa 1 giorno fa. Apertabug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
streams: DelimiterStream leaves delimiter bytes in the output when the delimiter spans more than two chunksForse già presa @helmipradita l’ha presa 15 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
@std/yaml: stringify() with condenseFlow wraps already quoted keys in a second pair of quotesForse già presa @sebxt l’ha presa 34 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
@std/ini parse silently drops an entire section when the section name repeatsForse già presa @Harsh23Kashyap l’ha presa 35 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
cli: parseArgs() treats an empty flag value passed without "=" as a positional argumentForse già presa @helmipradita l’ha presa 23 giorni fa. Apertabug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
denoland/std#7351 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di denoland/std
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vercel-labs/ui#1066 ·
I maintainer di solito rispondono entro 1 giorno
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ranxianglei/billion-context#7597 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation target:powerpoint
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
tomast1337/PdfLapas#602 ·
I maintainer di solito rispondono entro 1 giorno
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runForse già presa @kc9ddi l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TeraSky-OSS/backstage-plugins#228 ·