TS-3697: Fix frame type check for http/2 (cherry picked from commit 45c1133b9ea45003ae6491f4bd03edcf3ab8be37)
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/81a6807a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/81a6807a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/81a6807a Branch: refs/heads/5.3.x Commit: 81a6807a419051712feb2b7f93e62e3140f4001c Parents: 9031516 Author: Bryan Call <[email protected]> Authored: Tue Jun 16 14:59:18 2015 -0700 Committer: Phil Sorber <[email protected]> Committed: Mon Jun 29 13:48:08 2015 -0600 ---------------------------------------------------------------------- proxy/http2/Http2ConnectionState.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81a6807a/proxy/http2/Http2ConnectionState.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 8d7ec7d..11ec82f 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -640,8 +640,8 @@ Http2ConnectionState::main_event_handler(int event, void *edata) Http2ErrorCode error; // Implementations MUST ignore and discard any frame that has a type that is unknown. - ink_assert(frame->header().type < countof(frame_handlers)); - if (frame->header().type > countof(frame_handlers)) { + ink_assert(frame->header().type < Http2FrameType::HTTP2_FRAME_TYPE_MAX); + if (frame->header().type >= Http2FrameType::HTTP2_FRAME_TYPE_MAX) { return 0; }
