Skip to content

Commit a8ea760

Browse files
committed
Infinite loop during webservice request in io.helidon.http.http2.Http2Headers.DynamicTable#add helidon-io#10472
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent 8e6851f commit a8ea760

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

http/http2/src/main/java/io/helidon/http/http2/Http2Headers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,7 @@ void maxTableSize(long number) {
11751175
}
11761176
this.maxTableSize = number;
11771177
if (maxTableSize == 0) {
1178+
currentTableSize = 0;
11781179
headers.clear();
11791180
}
11801181
while (maxTableSize < currentTableSize) {

http/http2/src/test/java/io/helidon/http/http2/DynamicTableTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2022, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,6 +54,19 @@ void testDynamicTable() {
5454
testRecord(table, Http2Headers.StaticHeader.MAX_INDEX + 2, "b", "c");
5555
}
5656

57+
@Test
58+
void testIssue10472() {
59+
Http2Settings settings = Http2Settings.builder()
60+
.add(Http2Setting.HEADER_TABLE_SIZE, 35L)
61+
.build();
62+
63+
Http2Headers.DynamicTable table = Http2Headers.DynamicTable.create(settings);
64+
table.add(HeaderNames.create("a"), "aa"); // 35
65+
testRecord(table, Http2Headers.StaticHeader.MAX_INDEX + 1, "a", "aa");
66+
// This triggers the infinite loop
67+
table.maxTableSize(0L);
68+
}
69+
5770
private void testRecord(Http2Headers.DynamicTable table,
5871
int index,
5972
String expectedName,

0 commit comments

Comments
 (0)