@@ -979,8 +979,7 @@ int Http2Session::OnFrameReceive(nghttp2_session* handle,
979
979
frame->hd .type );
980
980
switch (frame->hd .type ) {
981
981
case NGHTTP2_DATA:
982
- session->HandleDataFrame (frame);
983
- break ;
982
+ return session->HandleDataFrame (frame);
984
983
case NGHTTP2_PUSH_PROMISE:
985
984
// Intentional fall-through, handled just like headers frames
986
985
case NGHTTP2_HEADERS:
@@ -1372,13 +1371,18 @@ void Http2Session::HandlePriorityFrame(const nghttp2_frame* frame) {
1372
1371
// Called by OnFrameReceived when a complete DATA frame has been received.
1373
1372
// If we know that this was the last DATA frame (because the END_STREAM flag
1374
1373
// is set), then we'll terminate the readable side of the StreamBase.
1375
- void Http2Session::HandleDataFrame (const nghttp2_frame* frame) {
1374
+ int Http2Session::HandleDataFrame (const nghttp2_frame* frame) {
1376
1375
int32_t id = GetFrameID (frame);
1377
1376
Debug (this , " handling data frame for stream %d" , id);
1378
1377
Http2Stream* stream = FindStream (id);
1379
1378
1380
- if (!stream->IsDestroyed () && frame->hd .flags & NGHTTP2_FLAG_END_STREAM)
1379
+ if (!stream->IsDestroyed () && frame->hd .flags & NGHTTP2_FLAG_END_STREAM) {
1381
1380
stream->EmitRead (UV_EOF);
1381
+ } else if (frame->hd .length == 0 &&
1382
+ !IsReverted (SECURITY_REVERT_CVE_2019_9518)) {
1383
+ return 1 ; // Consider 0-length frame without END_STREAM an error.
1384
+ }
1385
+ return 0 ;
1382
1386
}
1383
1387
1384
1388
0 commit comments