Skip to content

Prevent division by zero in QPACK Required Insert Count reconstruction - #549

Draft
freedom-winds wants to merge 1 commit into
ngtcp2:mainfrom
freedom-winds:pr/02-qpack-zero-capacity-ricnt-20260811194917-02
Draft

Prevent division by zero in QPACK Required Insert Count reconstruction#549
freedom-winds wants to merge 1 commit into
ngtcp2:mainfrom
freedom-winds:pr/02-qpack-zero-capacity-ricnt-20260811194917-02

Conversation

@freedom-winds

Copy link
Copy Markdown

Summary

Handle QPACK Required Insert Count reconstruction when the decoder dynamic table cannot hold a single entry.

Details

When hard_max_dtable_capacity is smaller than NGHTTP3_QPACK_ENTRY_OVERHEAD, the calculated number of entries is zero. For a nonzero encoded Required Insert Count, the reconstruction logic previously computed full == 0 and then divided by full, causing a division-by-zero crash.

This patch:

  • Detects a zero reconstruction range before division.
  • Returns NGHTTP3_ERR_QPACK_DECOMPRESSION_FAILED.
  • Adds a regression test using a decoder with zero dynamic-table capacity.

Security Impact

A malformed peer-controlled QPACK header block could crash the decoder process. The invalid input is now rejected safely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant