Skip to content

fix(fetch): use || for CRLF check in multipart formdata-parser#5049

Open
deepview-autofix wants to merge 1 commit intonodejs:mainfrom
deepview-autofix:deepview/83f62b6a51
Open

fix(fetch): use || for CRLF check in multipart formdata-parser#5049
deepview-autofix wants to merge 1 commit intonodejs:mainfrom
deepview-autofix:deepview/83f62b6a51

Conversation

@deepview-autofix
Copy link
Copy Markdown
Contributor

The CRLF validation in parseMultipartFormDataHeaders and the content-disposition attribute loop incorrectly used && instead of ||. With &&, the parser only failed/terminated when both bytes mismatched CRLF, so a stray \r (not followed by \n) or \n (not preceded by \r) was silently accepted. This could drop subsequent attributes such as filename and misalign header/body boundary detection. The other CRLF checks in the same file already use ||.

The CRLF validation in `parseMultipartFormDataHeaders` and the
content-disposition attribute loop incorrectly used `&&` instead of
`||`. With `&&`, the parser only failed/terminated when *both* bytes
mismatched CRLF, so a stray `\r` (not followed by `\n`) or `\n` (not
preceded by `\r`) was silently accepted. This could drop subsequent
attributes such as `filename` and misalign header/body boundary
detection. The other CRLF checks in the same file already use `||`.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: DeepView Autofix <276251120+deepview-autofix@users.noreply.github.com>
Co-Authored-By: Nikita Skovoroda <chalkerx@gmail.com>
Signed-off-by: Nikita Skovoroda <chalkerx@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.04%. Comparing base (d2e8178) to head (3044e7b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5049      +/-   ##
==========================================
+ Coverage   93.03%   93.04%   +0.01%     
==========================================
  Files         110      110              
  Lines       35793    35793              
==========================================
+ Hits        33299    33303       +4     
+ Misses       2494     2490       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants