On Mon, Jul 27, 2020 at 11:08:08AM +0200, Andreas Rheinhardt wrote:
> get_ue_golomb_31() reads nine bits and an array with 512 entries to
> parse golomb codes. The longest golomb codes that fit into 9 bits use
> four leading zeroes and five value bits and can encode numbers in the
> 0..30 range. 31 meanwhile is encoded on 11 bits and if the nine bits
> read coincide with the first nine bits of the encoding of 31,
> get_ue_golomb_31() returns 31 (and skips 11 bits).
> 
> But looking at the first nine bits only makes it impossible to distinguish
> 31 from 32..34. Therefore the documentation of get_ue_golomb_31() simply
> states that the return value is undefined if the value of the encountered
> exp golomb code was outside the 0..31 range.
> 
> But actually get_ue_golomb_31() does not behave that bad: If the returned
> value is in the range of 0..30, then this is the actually encountered value,
> so that this function can be used without any problems to parse and validate
> parameters whose legal values are a subset of the 0..30 range.
> 
> This commit documents this fact.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>
> ---
>  libavcodec/golomb.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to