diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-04-10 13:36:50 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-05-31 19:26:06 +0200 |
commit | 4264e4056c41e0dfc01a27d95f600ac91fb5a04f (patch) | |
tree | b0168564a04f35ca9910d240d47c56742e503dc6 | |
parent | 6fed1841a1f5dd3cdcf343f77925af0781ebe83a (diff) | |
download | ffmpeg-4264e4056c41e0dfc01a27d95f600ac91fb5a04f.tar.gz |
lavc/hevc_ps: fix variable signedness in ff_hevc_decode_short_term_rps()
It is actually supposed to go negative in the loop over num_negative
pics, but underflow does not break anything as the result is then
assigned to a signed int.
-rw-r--r-- | libavcodec/hevc_ps.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 1af691414e..d90f172c46 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -197,7 +197,8 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, } } } else { - unsigned int prev, nb_positive_pics; + unsigned int nb_positive_pics; + rps->num_negative_pics = get_ue_golomb_long(gb); nb_positive_pics = get_ue_golomb_long(gb); @@ -209,7 +210,8 @@ int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx, rps->num_delta_pocs = rps->num_negative_pics + nb_positive_pics; if (rps->num_delta_pocs) { - prev = 0; + int prev = 0; + for (i = 0; i < rps->num_negative_pics; i++) { delta_poc = rps->delta_poc_s0[i] = get_ue_golomb_long(gb) + 1; if (delta_poc < 1 || delta_poc > 32768) { |