Skip to content

avoid emitting a phantom byte on truncated input in QPDecoderStream#207

Open
arib06 wants to merge 1 commit into
eclipse-ee4j:masterfrom
arib06:qp-decode-eof-phantom-byte
Open

avoid emitting a phantom byte on truncated input in QPDecoderStream#207
arib06 wants to merge 1 commit into
eclipse-ee4j:masterfrom
arib06:qp-decode-eof-phantom-byte

Conversation

@arib06

@arib06 arib06 commented Jul 13, 2026

Copy link
Copy Markdown

QPDecoderStream.read casts the result of in.read() straight to a byte, so when an '=' is followed by a single hex digit (or a bare CR) at end of stream, the -1 becomes 0xFF and gets pushed back and later returned as a decoded byte that was never in the input. Quoted-printable bodies are untrusted MIME content, so a truncated encoded atom silently injects a 0xFF into the decoded output. This guards both the = and = reads for -1 so the real trailing bytes pass through unchanged, and adds a QPDecoderStreamTest covering the truncated cases.

Signed-off-by: mohammed arib <arib@bugqore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant