Skip to content

mime client reader, avoid infinite loop - #14532

Closed
icing wants to merge 2 commits into
curl:masterfrom
icing:mime-read-avoid-infinity
Closed

icing wants to merge 2 commits into
curl:masterfrom
icing:mime-read-avoid-infinity

Conversation

@icing

@icing icing commented Aug 13, 2024 •

Copy link
Copy Markdown
Contributor

Curl_mime_read() may go into an infinite loop when called with buffer lengths <= 4. Some encoders, like base64, are not prepared for that.

In the client reader for mime data, skip such small reads. The upload buffers will get flushed eventually and larger reads will happen again.

Improves robustness of test652 which triggered the loop on blocked sends.

Refs #14527.

@github-actions github-actions Bot added the MIME label Aug 13, 2024
@vszakats vszakats changed the title mime client reader, avoid inifite loop mime client reader, avoid inifinite loop Aug 13, 2024
@vszakats vszakats changed the title mime client reader, avoid inifinite loop mime client reader, avoid infinite loop Aug 13, 2024
@bagder

bagder commented Aug 14, 2024

Copy link
Copy Markdown
Member

scanbuild seems to have an opinion here!

@icing

icing commented Aug 14, 2024

Copy link
Copy Markdown
Contributor Author

scanbuild seems to have an opinion here!

I hate compilers that warn about "unnecessary inits". 🤮

icing added 2 commits August 14, 2024 12:00
Curl_mime_read() may go into an infinite loop when called with
buffer lengths <= 4. Some encoders, like base64, are not prepared
for that.

In the client reader for mime data, skip such small reads. The
upload buffers will get flushed eventually and larger reads will
happen again.

Improves robustness of test652 which triggered the loop on blocked
sends.
@icing
icing force-pushed the mime-read-avoid-infinity branch from a73e452 to f6c7d49 Compare August 14, 2024 10:01
@icing

icing commented Aug 14, 2024

Copy link
Copy Markdown
Contributor Author

Rebased and removed the init line.

@bagder bagder closed this in c90a3f1 Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants