WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@emmanuelthome
Copy link
Contributor

Save a trailing \r for the next stream even in order to avoid a newline marker being split by a chunk boundary.

This requires an adjustment of the test
test_decoder_data_start_with_different_newline_positions in tests/sansio/test_multipart.py. The difficult bit is relative to where the state machine of the parsing ends up while parsing invalid input. The only thing that happens is that the very first event is one byte smaller, and that is by design.

fixes #3065.

@davidism davidism changed the title Fix #3065 handle chunked input that splits \r\n Nov 27, 2025
@davidism davidism added this to the 3.1.4 milestone Nov 27, 2025
@davidism davidism changed the base branch from main to stable November 27, 2025 01:32
@davidism davidism merged commit 33bdb41 into pallets:stable Nov 27, 2025
13 checks passed
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.

werkzeug misdecodes multipart line breaks if 64kb chunk ends in the middle of final CR+LF

2 participants