Skip to content

Document the VLC prefix loops and avoid u32 wrap in dec_vlc_read() - #297

Merged
cpncf merged 3 commits into
mainfrom
comment_vlc_k_check
Sep 29, 2026
Merged

cpncf merged 3 commits into
mainfrom
comment_vlc_k_check

Conversation

@kpchoi

@kpchoi kpchoi commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator
  • Add comments to the prefix loops of dec_vlc_read_kparam0(), dec_vlc_read_1bit_read() and dec_vlc_read() explaining why k is not range-checked inside the loops and how a malformed bitstream is rejected.
  • In dec_vlc_read(), add the exp-golomb prefix sum once after the k check instead of per bit, so symbol cannot wrap on a malformed bitstream.
  • Add a comment to the KPARAM_*() macros explaining why no lower clamp is applied.

@kpchoi kpchoi changed the title Document why k is not checked inside the VLC prefix loops Document the VLC prefix loops and avoid u32 wrap in dec_vlc_read() Sep 29, 2026
Signed-off-by: KP Choi <19379257+kpchoi@users.noreply.github.com>
Signed-off-by: KP Choi <19379257+kpchoi@users.noreply.github.com>
Signed-off-by: KP Choi <19379257+kpchoi@users.noreply.github.com>
@kpchoi
kpchoi force-pushed the comment_vlc_k_check branch from 1282525 to 3fed5b7 Compare September 29, 2026 02:37

@cpncf cpncf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpncf
cpncf merged commit d3958a2 into main Sep 29, 2026
10 checks passed
@cpncf
cpncf deleted the comment_vlc_k_check branch September 29, 2026 05:18
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.

2 participants