From patchwork Tue Oct 22 13:16:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 15902 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9E338448B82 for ; Tue, 22 Oct 2019 16:17:25 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 84D1568AF43; Tue, 22 Oct 2019 16:17:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 922A068AEF0 for ; Tue, 22 Oct 2019 16:17:16 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id n15so7241269wrw.13 for ; Tue, 22 Oct 2019 06:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lwxTe97s3s/qHKOlap/AO0V4bCE+7M5x09DGND27/vU=; b=dO5l8oqEoadwXyGF9F8Fr7yUQwcol0rrOK+xivCSnLIQebUD1iWFZNGgWMsWE3p6kp PZiSsCPN+JvRYpXocQkGRLxfFDw1fPaU08xjTOeMFkV2b4PHnabpJ7ba8Rjya/5FmMHU Op4bL3JYJO+VVZLYgrrOZ3P+dL1OFlzTHHhshoE92TbB5MgAQrUgvU2eU4tKnT19jSKc 32uWlYZj78Qg6WG3x77e0UcCV1NuvbwGBZU2hi/dn+K3aSsnsBwn14KK70xbhMEtHPzb ZfJzOLEOhWqFv+ea4Y8jEYwcu1ucojAYlZranKh/DJQAD2W5DQfMTMotOWZPkAdQRYVg CmDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lwxTe97s3s/qHKOlap/AO0V4bCE+7M5x09DGND27/vU=; b=sbPc/U1Z+NkM9kFEVALLhQ/rDg2SjKD4i3b6u9n48CDdnoELvJncsf6hd2o9GQltBF VkdE6vm3Ju70fsL34Nd1a4eEZ51mLIm2A1wFPsmHKkmyT04CkgYiiUMGePegJ2Rd7YjN yDWuZZ7llnYbr30w59OKs39wjCVm/mKMem3ejTThseDkvjfhx1IrqGjAsACiS3dX+/kL wgxRC01HHb9vApO8zD2zUlnYRc35chkKK6ObOZUg5A2dVpk4qCE1sD/AxAT+L6SZClk4 lnIJpBPfbQ5QPumjQsg/hyy9EHcoR7lIe3ZqwNiiJnEUqEh/bHg4rrSzYOko06Jyv8/l iLRg== X-Gm-Message-State: APjAAAXgGhGS+bVRqEXuT3Fxm5S9A4GvgLFhbOw6ZRvJuNOgWOkYoH6P IojO1iOshgcHvu/Ch9aIG+kEfSrl X-Google-Smtp-Source: APXvYqxZ7nBah4fuAKN3HqZMckCBCzT6Rfd2R+Th2VtSqJxR0yTrjHrBcJDqGhnmE9FMhRauD1ZjCQ== X-Received: by 2002:a05:6000:1c9:: with SMTP id t9mr3706386wrx.171.1571750235942; Tue, 22 Oct 2019 06:17:15 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc08937.dynamic.kabel-deutschland.de. [188.192.137.55]) by smtp.gmail.com with ESMTPSA id o70sm25074520wme.29.2019.10.22.06.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 06:17:15 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 22 Oct 2019 15:16:45 +0200 Message-Id: <20191022131645.8394-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191022131645.8394-1-andreas.rheinhardt@gmail.com> References: <20191022131645.8394-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] avformat/mpeg: Don't use unintialized value X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" vobsub_read_packet() didn't check whether an index in array of AVPackets was valid and therefore used uninitialized values. Signed-off-by: Andreas Rheinhardt --- Actually I only wanted to use Valgrind to check for memleaks... libavformat/mpeg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 73ade71d95..474afd06b9 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -930,6 +930,10 @@ static int vobsub_read_packet(AVFormatContext *s, AVPacket *pkt) FFDemuxSubtitlesQueue *tmpq = &vobsub->q[i]; int64_t ts; av_assert0(tmpq->nb_subs); + + if (tmpq->current_sub_idx >= tmpq->nb_subs) + continue; + ts = tmpq->subs[tmpq->current_sub_idx].pts; if (ts < min_ts) { min_ts = ts;