beast: buffer overflow handling for string_body and mutable_body
Beast/v70
Was looking at test coverage to find untested parts to increase coverage. So i discovered this:
try
{
body_.resize(len + n);
}
catch(std::length_error const&)
{
ec = error::buffer_overflow;
return;
}
ec.assign(0, ec.category());
There you catch std::length_error only.
What about the exceptions thrown by corresponding Allocator?
e.g. std::bad_alloc
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 26 (26 by maintainers)
Commits related to this issue
- Fix buffer overflow handling for string_body and mutable_body fix #553, fix #558 — committed to boostorg/beast by octopus-prime 7 years ago
- Fix buffer overflow handling for string_body and mutable_body fix #553, fix #558 — committed to boostorg/beast by octopus-prime 7 years ago
- Fix buffer overflow handling for string_body and mutable_body fix #553, fix #558 — committed to boostorg/beast by octopus-prime 7 years ago
- Fix buffer overflow handling for string_body and mutable_body fix #553, fix #558 — committed to boostorg/beast by octopus-prime 7 years ago
- Fix buffer overflow handling for string_body and mutable_body fix #553, fix #558 — committed to boostorg/beast by octopus-prime 7 years ago
Is “Fix buffer overflow handling for string_body” as commit message okay?
By the way, these are the kinds of bugs we like, easy to fix and doesn’t change any public interfaces. As long as there is no major design problem with interfaces, then we’re in good shape - things like this can be cleaned up over time (not saying we shouldn’t fix it now but this is not as severe as an interface design flaw).
I would suggest catching
std::exceptionand always mapping toerror::buffer_overflow.