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

frame decodes past the end of the input and leaves the state there

Aperta Adatta ai principianti
#18 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Inizia dall'helper frame nel pacchetto che espone c.frame e State; legge la lunghezza annunciata e passa il buffer al sub-decoder senza prima controllare che seguano tanti byte. Riproduci con State(bytes.fromhex('0501')) e frame(c.uint) e conferma che il riferimento rifiuta. Fatto quando quell'input viene rifiutato invece di restituire 1, State.remaining non diventa mai negativo, e il caso del corpus frame-uint-length-past-the-end passa insieme ai test frame esistenti.

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

Descrizione

Found by running the compact-encoding-test conformance corpus against this port.

frame decodes a frame whose announced length is longer than the bytes that follow it, and leaves the state past the end of the buffer rather than refusing:

import compact_encoding as c

s = c.State(bytes.fromhex('0501'))     # a frame announcing 5 bytes, with 1 following
print(c.frame(c.uint).decode(s))       # 1
print(s.start, len(s.buffer))          # 6 2
print(s.remaining)                     # -4

The reference rejects these bytes. remaining going negative is the part that matters beyond the wrong answer: a later read from the same state is working from a position past the buffer, so a truncated or hostile frame corrupts everything decoded after it rather than failing where the problem is.

The corpus case is frame-uint-length-past-the-end, citing the rule frame-rejects-a-length-past-the-end: "a decoder rejects a frame announcing more bytes than follow it, rather than reading the value and leaving off past the end of the input, so 0501 is a rejection and not a 1."

Reading the value inside the announced length and rejecting what runs past it is a separate rule, frame-bounds-its-value, which this port passes.

Lingua principale
Python
Stelle
1
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 holepunchto/compact-encoding-python

Tutte le issue di holepunchto/compact-encoding-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.