Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta Para iniciantes
#18 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
74/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
tooling

Direção de pesquisa

Comece no helper frame no pacote que expõe c.frame e State; ele lê o comprimento anunciado e entrega o buffer ao sub-decoder sem antes verificar que tantos bytes sigam. Reproduza com State(bytes.fromhex('0501')) e frame(c.uint) e confirme que a referência rejeita. Pronto quando essa entrada for recusada em vez de retornar 1, State.remaining nunca ficar negativo, e o caso do corpus frame-uint-length-past-the-end passar junto com os testes de frame existentes.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
1
Forks
1
Merge médio
4d 6h
PRs com merge (30d)
1

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de holepunchto/compact-encoding-python

Todas as issues de holepunchto/compact-encoding-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.