| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 156f2f3 commit a319168
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1031,8 +1031,7 @@ int Http2Session::OnFrameReceive(nghttp2_session* handle, | |||
| 1031 | 1031 | frame->hd.type); | |
| 1032 | 1032 | switch (frame->hd.type) { | |
| 1033 | 1033 | case NGHTTP2_DATA: | |
| 1034 | - session->HandleDataFrame(frame); | ||
| 1035 | - break; | ||
| 1034 | + return session->HandleDataFrame(frame); | ||
| 1036 | 1035 | case NGHTTP2_PUSH_PROMISE: | |
| 1037 | 1036 | // Intentional fall-through, handled just like headers frames | |
| 1038 | 1037 | case NGHTTP2_HEADERS: | |
@@ -1408,18 +1407,18 @@ void Http2Session::HandlePriorityFrame(const nghttp2_frame* frame) { | |||
| 1408 | 1407 | // Called by OnFrameReceived when a complete DATA frame has been received. | |
| 1409 | 1408 | // If we know that this was the last DATA frame (because the END_STREAM flag | |
| 1410 | 1409 | // is set), then we'll terminate the readable side of the StreamBase. | |
| 1411 | - inline void Http2Session::HandleDataFrame(const nghttp2_frame* frame) { | ||
| 1410 | + int Http2Session::HandleDataFrame(const nghttp2_frame* frame) { | ||
| 1412 | 1411 | int32_t id = GetFrameID(frame); | |
| 1413 | 1412 | DEBUG_HTTP2SESSION2(this, "handling data frame for stream %d", id); | |
| 1414 | 1413 | Http2Stream* stream = FindStream(id); | |
| 1415 | 1414 | ||
| 1416 | - // If the stream has already been destroyed, do nothing | ||
| 1417 | - if (stream->IsDestroyed()) | ||
| 1418 | - return; | ||
| 1419 | - | ||
| 1420 | - if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { | ||
| 1415 | + if (!stream->IsDestroyed() && frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { | ||
| 1421 | 1416 | stream->EmitData(UV_EOF, Local<Object>(), Local<Object>()); | |
| 1417 | + } else if (frame->hd.length == 0 && | ||
| 1418 | + !IsReverted(SECURITY_REVERT_CVE_2019_9518)) { | ||
| 1419 | + return 1; // Consider 0-length frame without END_STREAM an error. | ||
| 1422 | 1420 | } | |
| 1421 | + return 0; | ||
| 1423 | 1422 | } | |
| 1424 | 1423 | ||
| 1425 | 1424 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -940,14 +940,14 @@ class Http2Session : public AsyncWrap { | |||
| 940 | 940 | size_t maxPayloadLen); | |
| 941 | 941 | ||
| 942 | 942 | // Frame Handler | |
| 943 | - inline void HandleDataFrame(const nghttp2_frame* frame); | ||
| 944 | - inline void HandleGoawayFrame(const nghttp2_frame* frame); | ||
| 945 | - inline void HandleHeadersFrame(const nghttp2_frame* frame); | ||
| 946 | - inline void HandlePriorityFrame(const nghttp2_frame* frame); | ||
| 947 | - inline void HandleSettingsFrame(const nghttp2_frame* frame); | ||
| 948 | - inline void HandlePingFrame(const nghttp2_frame* frame); | ||
| 949 | - inline void HandleAltSvcFrame(const nghttp2_frame* frame); | ||
| 950 | - inline void HandleOriginFrame(const nghttp2_frame* frame); | ||
| 943 | + int HandleDataFrame(const nghttp2_frame* frame); | ||
| 944 | + void HandleGoawayFrame(const nghttp2_frame* frame); | ||
| 945 | + void HandleHeadersFrame(const nghttp2_frame* frame); | ||
| 946 | + void HandlePriorityFrame(const nghttp2_frame* frame); | ||
| 947 | + void HandleSettingsFrame(const nghttp2_frame* frame); | ||
| 948 | + void HandlePingFrame(const nghttp2_frame* frame); | ||
| 949 | + void HandleAltSvcFrame(const nghttp2_frame* frame); | ||
| 950 | + void HandleOriginFrame(const nghttp2_frame* frame); | ||
| 951 | 951 | ||
| 952 | 952 | // nghttp2 callbacks | |
| 953 | 953 | static inline int OnBeginHeadersCallback( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ namespace node { | |||
| 19 | 19 | XX(CVE_2018_12116, "CVE-2018-12116", "HTTP request splitting") \ | |
| 20 | 20 | XX(CVE_2019_9514, "CVE-2019-9514", "HTTP/2 Reset Flood") \ | |
| 21 | 21 | XX(CVE_2019_9516, "CVE-2019-9516", "HTTP/2 0-Length Headers Leak") \ | |
| 22 | + XX(CVE_2019_9518, "CVE-2019-9518", "HTTP/2 Empty DATA Frame Flooding") \ | ||
| 22 | 23 | // XX(CVE_2016_PEND, "CVE-2016-PEND", "Vulnerability Title") | |
| 23 | 24 | // TODO(addaleax): Remove all of the above before Node.js 13 as the comment | |
| 24 | 25 | // at the start of the file indicates. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments