[FFmpeg-cvslog] avcodec/h264_ps: Don't output invalid chroma location

Andreas Rheinhardt git at videolan.org
Thu Dec 1 12:39:00 EET 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Jul  2 17:25:10 2022 +0200| [1e38e7fd14492a71665bc7084cd871c6fb5e8d28] | committer: Andreas Rheinhardt

avcodec/h264_ps: Don't output invalid chroma location

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e38e7fd14492a71665bc7084cd871c6fb5e8d28
---

 libavcodec/h264_ps.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 1fd7375a13..874790a3a3 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -181,7 +181,11 @@ static inline int decode_vui_parameters(GetBitContext *gb, void *logctx,
     /* chroma_location_info_present_flag */
     if (get_bits1(gb)) {
         /* chroma_sample_location_type_top_field */
-        sps->chroma_location = get_ue_golomb_31(gb) + 1;
+        sps->chroma_location = get_ue_golomb_31(gb);
+        if (sps->chroma_location <= 5U)
+            sps->chroma_location++;
+        else
+            sps->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
         get_ue_golomb_31(gb);  /* chroma_sample_location_type_bottom_field */
     } else
         sps->chroma_location = AVCHROMA_LOC_LEFT;



More information about the ffmpeg-cvslog mailing list