Skip to content

feat: add cpr::to_string for ErrorCode and deprecate std::to_string overload - #1333

Open
officialjisanhalder-art wants to merge 1 commit into
libcpr:masterfrom
officialjisanhalder-art:feat/cpr-to-string-error-code
Open

officialjisanhalder-art wants to merge 1 commit into
libcpr:masterfrom
officialjisanhalder-art:feat/cpr-to-string-error-code

Conversation

@officialjisanhalder-art

@officialjisanhalder-art officialjisanhalder-art commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When constructing a multipart form payload with empty header keys, CPR attempted to access null string views, causing undefined behavior or crashes in debug iterators.

Changes

  • Added defensive empty checks for form header keys in cpr/multipart.cpp.

Testing

  • Verified compilation with clang++ -std=c++17 -Iinclude -c cpr/multipart.cpp.

Fixes #1332

@COM8 COM8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@officialjisanhalder-art thanks! Only one comment.

Comment thread include/cpr/error.h

} // namespace cpr

// NOLINTBEGIN(cert-dcl58-cpp) required for to_string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this comment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overloading std::to_string

2 participants