You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2019/03/26 02:19:34 UTC
[trafficserver] branch quic-latest updated: Fix
QPACK::_encode_prefix()
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 2df6d5c Fix QPACK::_encode_prefix()
2df6d5c is described below
commit 2df6d5c7dca88649ab3c999b138e145441f0c457
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Tue Mar 26 11:15:45 2019 +0900
Fix QPACK::_encode_prefix()
Prior this change, the allocated IOBufferData for Header Block Prefix was not initialized.
This made random value in S and Delta Base (7+) fields in Header Block Prefix.
---
proxy/http3/QPACK.cc | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/proxy/http3/QPACK.cc b/proxy/http3/QPACK.cc
index bd8f51d..a2d2054 100644
--- a/proxy/http3/QPACK.cc
+++ b/proxy/http3/QPACK.cc
@@ -297,15 +297,17 @@ QPACK::_encode_prefix(uint16_t largest_reference, uint16_t base_index, IOBufferB
prefix->fill(ret);
uint16_t delta;
+ prefix->end()[0] = 0x0;
if (base_index < largest_reference) {
prefix->end()[0] |= 0x80;
delta = largest_reference - base_index;
} else {
delta = base_index - largest_reference;
}
+
if ((ret = xpack_encode_integer(reinterpret_cast<uint8_t *>(prefix->end()),
reinterpret_cast<uint8_t *>(prefix->end() + prefix->write_avail()), delta, 7)) < 0) {
- return -1;
+ return -2;
}
prefix->fill(ret);
@@ -872,11 +874,12 @@ QPACK::_decode_header(const uint8_t *header_block, size_t header_block_len, HTTP
uint64_t delta_base_index;
uint16_t base_index;
if ((ret = xpack_decode_integer(delta_base_index, pos, pos + remain_len, 7)) < 0 && delta_base_index < 0xFFFF) {
- return -1;
+ return -2;
}
+
if (pos[0] & 0x80) {
if (delta_base_index == 0) {
- return -1;
+ return -3;
}
base_index = largest_reference - delta_base_index;
} else {
@@ -923,8 +926,10 @@ QPACK::_decode(EThread *ethread, Continuation *cont, uint64_t stream_id, const u
HTTPHdr &hdr)
{
int event;
- if (this->_decode_header(header_block, header_block_len, hdr) < 0) {
+ int res = this->_decode_header(header_block, header_block_len, hdr);
+ if (res < 0) {
event = QPACK_EVENT_DECODE_FAILED;
+ QPACKDebug("decoding header failed (%d)", res);
} else {
event = QPACK_EVENT_DECODE_COMPLETE;
this->_write_header_acknowledgement(stream_id);