[FFmpeg-devel] [PATCH 17/20] avcodec/h264_ps: Don't output invalid chroma location
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sun Jul 3 01:21:57 EEST 2022
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at 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
More information about the ffmpeg-devel
mailing list