]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dirac.c
Merge commit 'fa463aa83a4920b0eed47ad1f79775dfc53d21ec'
[ffmpeg] / libavcodec / dirac.c
index 33cc96098c96cdcf62f6440641b8387aac1cf608..faf5534e88fe19bc3975f741709b05bf5e049a82 100644 (file)
@@ -262,6 +262,9 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
 
     dsh->bit_depth = luma_depth;
 
+    if (dsh->pixel_range_index < 2U)
+        return AVERROR_INVALIDDATA;
+
     dsh->pix_fmt = dirac_pix_fmt[dsh->chroma_format][dsh->pixel_range_index-2];
     avcodec_get_chroma_sub_sample(dsh->pix_fmt, &chroma_x_shift, &chroma_y_shift);
     if ((dsh->width % (1<<chroma_x_shift)) || (dsh->height % (1<<chroma_y_shift))) {