1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/h264_ps: Don't output invalid chroma location

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-07-02 17:25:10 +02:00
parent 881e8bcc51
commit 1e38e7fd14

View File

@ -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;