litespeedtech/ls-qpack

Decoder breaks if "Set Dynamic Table Capacity" instruction doesn't match its initial capacity

Closed this issue · 3 comments

If the other side chooses a smaller dynamic table size than what we initialized the decoder with, decoding headers will fail or get corrupted.

We think it’s because qpd_max_entries isn’t updated in qdec_update_max_capacity.

Reproducing project attached: qpack_bug_repro.zip If you increase the initial dynamic table capacity by even 1 from 16383 to 16384, decoding starts failing.

Thank, we will add it as a test case.
The fix to this particular case is easy, like you said, just update qpd_max_entries accordingly.
However, more complicate logic is related to qpd_max_entries and qpd_largest_known_id, those also need to be updated, I believe. RFC allows changing dynamic table size up and down at anytime, make it more tricky. may need bigger change to get it right.

Please check the fix.

Looks good, thanks!