ubeddulla commented on code in PR #3462:
URL: https://github.com/apache/brpc/pull/3462#discussion_r3796807009
##########
src/brpc/details/hpack.cpp:
##########
@@ -223,9 +223,13 @@ int IndexTable::Init(const IndexTableOptions& options) {
num_headers = options.static_table_size;
_max_size = UINT_MAX;
} else {
- num_headers = options.max_size / (32 + 2);
+ num_headers = options.max_size / (32 + 1);
Review Comment:
Good catch. Pushed a guard that keeps num_headers at 1 when max_size is
below 33 (including the max_size == 0 disable case), so we don't hit malloc(0).
Nothing actually lands in that slot since entry_size > _max_size still holds in
AddHeader. Added a test that Init(0) succeeds.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]