Message ID | 20200714153454.9354-3-andreas.rheinhardt@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [FFmpeg-devel] avcodec/golomb: Prevent shift by negative number | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 172d9934e0..8b69196d44 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -135,7 +135,8 @@ static inline unsigned get_ue_golomb_long(GetBitContext *gb) /** * Read unsigned exp golomb code, constraint to a max of 30. - * the return value is undefined if the stored value exceeds 30. + * The return value is outside the range of 0..30 if no exp golomb code + * in that range was encountered. */ static inline int get_ue_golomb_30(GetBitContext *gb) {
If the return value is undefined if the value of the encountered exp golomb code was outside the 0..30 range, said function can't be used anywhere where one wants to check for correctness. So document that in this case the return value is outside the range 0..30 (it currently always returns 32 in this case). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- Btw: get_ue_golomb_30() could be used to skip exp golomb codes with length <= 17 bits. libavcodec/golomb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)