diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index e05101f4f9..ae4dbf7b10 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2181,7 +2181,7 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska, } memcpy(track->audio.buf + y*w, data, w); } else { - if (size < sps * w / sps || h<=0) { + if (size < sps * w / sps || h<=0 || w%sps) { av_log(matroska->ctx, AV_LOG_ERROR, "Corrupt generic RM-style audio packet size\n"); return AVERROR_INVALIDDATA;