mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 07:12:05 +02:00
Reasoning: The function `NextTableBitSize` is only called by `BuildHuffmanTable` (src/utils/huffman_utils.c:196). In `BuildHuffmanTable`, `count` is defined as a local array `int count[MAX_ALLOWED_CODE_LENGTH + 1]` (line 93). This array decays to a pointer when passed to `NextTableBitSize`. The maximum index accessed within `NextTableBitSize` is `MAX_ALLOWED_CODE_LENGTH - 1` (line 75, inside a loop where `len` starts <= `MAX_ALLOWED_CODE_LENGTH` and increments up to `MAX_ALLOWED_CODE_LENGTH`). Since the caller provides an array of size `MAX_ALLOWED_CODE_LENGTH + 1` and the accesses are within bounds, the `count` parameter in `NextTableBitSize` is annotated with `WEBP_COUNTED_BY(MAX_ALLOWED_CODE_LENGTH + 1)`. This resolves the compiler error. Bug: 432511821 Change-Id: I29a55dd7f09c04aa3a2394996cf0e123d985fcd0