@@ -980,8 +980,7 @@ int Http2Session::OnFrameReceive(nghttp2_session* handle,
980980 frame->hd .type );
981981 switch (frame->hd .type ) {
982982 case NGHTTP2_DATA:
983- session->HandleDataFrame (frame);
984- break ;
983+ return session->HandleDataFrame (frame);
985984 case NGHTTP2_PUSH_PROMISE:
986985 // Intentional fall-through, handled just like headers frames
987986 case NGHTTP2_HEADERS:
@@ -1398,13 +1397,18 @@ void Http2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
13981397// Called by OnFrameReceived when a complete DATA frame has been received.
13991398// If we know that this was the last DATA frame (because the END_STREAM flag
14001399// 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) {
14021401 int32_t id = GetFrameID (frame);
14031402 Debug (this , " handling data frame for stream %d" , id);
14041403 Http2Stream* stream = FindStream (id);
14051404
1406- if (!stream->IsDestroyed () && frame->hd .flags & NGHTTP2_FLAG_END_STREAM)
1405+ if (!stream->IsDestroyed () && frame->hd .flags & NGHTTP2_FLAG_END_STREAM) {
14071406 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 ;
14081412}
14091413
14101414
0 commit comments