@@ -980,8 +980,7 @@ int Http2Session::OnFrameReceive(nghttp2_session* handle,
980
980
frame->hd .type );
981
981
switch (frame->hd .type ) {
982
982
case NGHTTP2_DATA:
983
- session->HandleDataFrame (frame);
984
- break ;
983
+ return session->HandleDataFrame (frame);
985
984
case NGHTTP2_PUSH_PROMISE:
986
985
// Intentional fall-through, handled just like headers frames
987
986
case NGHTTP2_HEADERS:
@@ -1398,13 +1397,18 @@ void Http2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
1398
1397
// Called by OnFrameReceived when a complete DATA frame has been received.
1399
1398
// If we know that this was the last DATA frame (because the END_STREAM flag
1400
1399
// is set), then we'll terminate the readable side of the StreamBase.
1401
- void Http2Session::HandleDataFrame (const nghttp2_frame* frame) {
1400
+ int Http2Session::HandleDataFrame (const nghttp2_frame* frame) {
1402
1401
int32_t id = GetFrameID (frame);
1403
1402
Debug (this , " handling data frame for stream %d" , id);
1404
1403
Http2Stream* stream = FindStream (id);
1405
1404
1406
- if (!stream->IsDestroyed () && frame->hd .flags & NGHTTP2_FLAG_END_STREAM)
1405
+ if (!stream->IsDestroyed () && frame->hd .flags & NGHTTP2_FLAG_END_STREAM) {
1407
1406
stream->EmitRead (UV_EOF);
1407
+ } else if (frame->hd .length == 0 &&
1408
+ !IsReverted (SECURITY_REVERT_CVE_2019_9518)) {
1409
+ return 1 ; // Consider 0-length frame without END_STREAM an error.
1410
+ }
1411
+ return 0 ;
1408
1412
}
1409
1413
1410
1414
0 commit comments