[FFmpeg-devel] [PATCH 1/3] mpeg12dec: validate color space
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Fri Dec 23 01:57:35 EET 2016
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
libavcodec/mpeg12dec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 63979079c8..d3dc67ad6a 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1470,6 +1470,10 @@ static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
s->avctx->color_primaries = get_bits(&s->gb, 8);
s->avctx->color_trc = get_bits(&s->gb, 8);
s->avctx->colorspace = get_bits(&s->gb, 8);
+ if (!av_color_space_name(s->avctx->colorspace)) {
+ av_log(s->avctx, AV_LOG_WARNING, "Invalid color space %d, setting to unspecified\n", s->avctx->colorspace);
+ s->avctx->colorspace = AVCOL_SPC_UNSPECIFIED;
+ }
}
w = get_bits(&s->gb, 14);
skip_bits(&s->gb, 1); // marker
--
2.11.0
More information about the ffmpeg-devel
mailing list