Commit e32b07ae authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/mov: Stricter sanity checks on the display_matrix

Fixes "broken" tkhd
Found-by: koda
Tested-by: koda
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 41e983f1
...@@ -2874,7 +2874,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2874,7 +2874,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
disp_transform[i] = sqrt(SQR(display_matrix[i][0]) + SQR(display_matrix[i][1])); disp_transform[i] = sqrt(SQR(display_matrix[i][0]) + SQR(display_matrix[i][1]));
if (disp_transform[0] > 0 && disp_transform[1] > 0 && if (disp_transform[0] > 0 && disp_transform[1] > 0 &&
disp_transform[0] < (1<<24) && disp_transform[1] < (1<<24) &&
fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01) fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
st->sample_aspect_ratio = av_d2q( st->sample_aspect_ratio = av_d2q(
disp_transform[0] / disp_transform[1], disp_transform[0] / disp_transform[1],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment