Fix QpackDecoder::EncoderStreamRelativeIndexToAbsoluteIndex(), simplify QpackProgressiveDecoder::RequestStreamRelativeIndexToAbsoluteIndex(). gfe-relnote: n/a, change to QUIC v99-only code. Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99. PiperOrigin-RevId: 263413585 Change-Id: I1aab74f6f0d825079779f4d402c9ae1c94a368cd
diff --git a/quic/core/qpack/qpack_decoder.cc b/quic/core/qpack/qpack_decoder.cc index 79db4dd..8e3103c 100644 --- a/quic/core/qpack/qpack_decoder.cc +++ b/quic/core/qpack/qpack_decoder.cc
@@ -4,8 +4,6 @@ #include "net/third_party/quiche/src/quic/core/qpack/qpack_decoder.h" -#include <limits> - #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h" @@ -115,9 +113,7 @@ bool QpackDecoder::EncoderStreamRelativeIndexToAbsoluteIndex( uint64_t relative_index, uint64_t* absolute_index) const { - if (relative_index == std::numeric_limits<uint64_t>::max() || - relative_index + 1 > std::numeric_limits<uint64_t>::max() - - header_table_.inserted_entry_count()) { + if (relative_index >= header_table_.inserted_entry_count()) { return false; }
diff --git a/quic/core/qpack/qpack_decoder_test.cc b/quic/core/qpack/qpack_decoder_test.cc index 506d60c..556053b 100644 --- a/quic/core/qpack/qpack_decoder_test.cc +++ b/quic/core/qpack/qpack_decoder_test.cc
@@ -425,7 +425,7 @@ TEST_P(QpackDecoderTest, EncoderStreamErrorInvalidDynamicTableEntry) { EXPECT_CALL(encoder_stream_error_delegate_, - OnEncoderStreamError(Eq("Dynamic table entry not found."))); + OnEncoderStreamError(Eq("Invalid relative index."))); DecodeEncoderStreamData(QuicTextUtils::HexDecode( "6294e703626172" // Add literal entry with name "foo" and value "bar". @@ -436,7 +436,7 @@ TEST_P(QpackDecoderTest, EncoderStreamErrorDuplicateInvalidEntry) { EXPECT_CALL(encoder_stream_error_delegate_, - OnEncoderStreamError(Eq("Dynamic table entry not found."))); + OnEncoderStreamError(Eq("Invalid relative index."))); DecodeEncoderStreamData(QuicTextUtils::HexDecode( "6294e703626172" // Add literal entry with name "foo" and value "bar".
diff --git a/quic/core/qpack/qpack_progressive_decoder.cc b/quic/core/qpack/qpack_progressive_decoder.cc index b3c374e..d9449e3 100644 --- a/quic/core/qpack/qpack_progressive_decoder.cc +++ b/quic/core/qpack/qpack_progressive_decoder.cc
@@ -346,8 +346,7 @@ bool QpackProgressiveDecoder::RequestStreamRelativeIndexToAbsoluteIndex( uint64_t relative_index, uint64_t* absolute_index) const { - if (relative_index == std::numeric_limits<uint64_t>::max() || - relative_index + 1 > base_) { + if (relative_index >= base_) { return false; }