diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 5fb1921dd9..9dfb95650f 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -136,6 +136,8 @@ static int parse_strk(AVFormatContext *s, av_log(s, AV_LOG_ERROR, "current_track too large\n"); return AVERROR_INVALIDDATA; } + if (track < 0) + return AVERROR_INVALIDDATA; if (track + 1 > fourxm->track_count) { AudioTrack *tmp = av_realloc(fourxm->tracks, (track + 1) * sizeof(AudioTrack));