matroskadec: prevent potential integer overflow
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 5 Aug 2012 15:04:59 +0000 (17:04 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 5 Aug 2012 15:59:12 +0000 (17:59 +0200)
Iam not sure this can happen, but its safer we check.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/matroskadec.c

index 0f18087..500048f 100644 (file)
@@ -1580,7 +1580,7 @@ static int matroska_read_header(AVFormatContext *s)
                    && (track->codec_priv.data != NULL)) {
             fourcc = AV_RL32(track->codec_priv.data);
             codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
-        } else if (codec_id == CODEC_ID_ALAC && track->codec_priv.size) {
+        } else if (codec_id == CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX-12) {
             /* Only ALAC's magic cookie is stored in Matroska's track headers.
                Create the "atom size", "tag", and "tag version" fields the
                decoder expects manually. */