frame decodes past the end of the input and leaves the state there
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
Línea de trabajo
Comienza en el helper frame del paquete que expone c.frame y State; lee la longitud anunciada y entrega el búfer al sub-decodificador sin comprobar primero que sigan tantos bytes. Reproduce con State(bytes.fromhex('0501')) y frame(c.uint) y confirma que la referencia rechaza. Listo cuando esa entrada sea rechazada en lugar de devolver 1, State.remaining nunca sea negativo, y el caso del corpus frame-uint-length-past-the-end pase junto con las pruebas de frame existentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 1
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de holepunchto/compact-encoding-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
Todos los issues de holepunchto/compact-encoding-python
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
UKGovernmentBEIS/control-arena#917 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
debpalash/VoiceStudio#2937 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
aws-samples/sample-per-model-bedrock#261 ·
Los mantenedores suelen responder en 1 día