Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle invalid CRLF in header name. fixes #122 #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jhnstrk
Copy link
Contributor

@jhnstrk jhnstrk commented Apr 23, 2024

This handles the case of an unexpected CR in the middle of a part header, before the colon. This is the underlying cause associated with an IndexError in #122.

As far as I can tell, a CR after some header name bytes have been read, (i.e. not at the start of the line and before a colon) is always invalid, so we can just raise an error when it's encountered.

The code change altered an existing test result because an invalid CR is detected, before the absence of "LF" after, so the offset associated with the error is one less.

In the test data for #122 there's also a boundary string in the header, but this is not directly a problem - it's the CRLF at the end of the boundary that's invalid syntax.

@manunio
Copy link
Contributor

manunio commented Jun 27, 2024

DavidKorczynski pushed a commit to google/oss-fuzz that referenced this pull request Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants