Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
 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;
-- 
2.34.1

_______________________________________________
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