Skip to content

Commit

Permalink
http2: adds check about dynamic headers table size
Browse files Browse the repository at this point in the history
(cherry picked from commit 3de0123)
  • Loading branch information
catenacyber authored and victorjulien committed Jun 7, 2021
1 parent a3f9443 commit 2504b96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rust/src/http2/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,9 @@ fn http2_parse_headers_block_dynamic_size<'a>(
if (maxsize2 as usize) < dyn_headers.max_size {
//dyn_headers.max_size is updated later with all headers
//may evict entries
while dyn_headers.current_size > (maxsize2 as usize) {
while dyn_headers.current_size > (maxsize2 as usize) && dyn_headers.table.len() > 0 {
// we check dyn_headers.table as we may be in best effort
// because the previous maxsize was too big for us to retain all the headers
dyn_headers.current_size -=
32 + dyn_headers.table[0].name.len() + dyn_headers.table[0].value.len();
dyn_headers.table.remove(0);
Expand Down

0 comments on commit 2504b96

Please sign in to comment.