Skip to content

Commit 908da97

Browse files
Shiv Kushwahfacebook-github-bot
authored andcommitted
Fix fuzzing tests for HTTPBinaryCodec for incompletely formed messages
Summary: Task T135622359 showed a fuzzing test failure where the HTTPBinaryCodec could crash on incompletely formed messages. This diff patches the issue. Reviewed By: zhang00000 Differential Revision: D40861967 fbshipit-source-id: 3443686b37b972bff1a8839335b4df055f4552ba
1 parent 235cd7a commit 908da97

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

third-party/proxygen/src/proxygen/lib/http/codec/HTTPBinaryCodec.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,20 @@ void HTTPBinaryCodec::onIngressEOF() {
429429
HTTPException(HTTPException::Direction::INGRESS,
430430
fmt::format("Invalid Message: {}", *parseError_)));
431431
} else {
432-
// Case where the sent message only contains control data
433-
if (!msg_ && state_ == ParseState::HEADERS_SECTION) {
434-
msg_ = std::move(decodeInfo_.msg);
432+
433+
if (!msg_) {
434+
if (state_ == ParseState::HEADERS_SECTION) {
435+
// Case where the sent message only contains control data
436+
msg_ = std::move(decodeInfo_.msg);
437+
} else {
438+
callback_->onError(
439+
ingressTxnID_,
440+
HTTPException(
441+
HTTPException::Direction::INGRESS,
442+
fmt::format("Message not formed (incomplete binary data)")));
443+
return;
444+
}
435445
}
436-
CHECK(msg_);
437446
callback_->onHeadersComplete(ingressTxnID_, std::move(msg_));
438447
if (msgBody_) {
439448
callback_->onBody(ingressTxnID_, std::move(msgBody_), 0);

0 commit comments

Comments
 (0)