From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 0F6754A2C6 for ; Tue, 26 Mar 2024 01:29:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BD4DB68D5A1; Tue, 26 Mar 2024 03:29:15 +0200 (EET) Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9C4DE68D50B for ; Tue, 26 Mar 2024 03:29:09 +0200 (EET) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6e74bd85f26so3913393b3a.1 for ; Mon, 25 Mar 2024 18:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711416547; x=1712021347; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Mt57Ph8Spha2gi0W8Ru2CGiLSoI8PKHWGavfwJ1Z2V8=; b=OEKD3Ski9s3nEbDjpSMPThe5Um98CIU6q9IwRzO1kqE65VnSDXsXvqVGx2FuT2/Uuy /hF4DgGRK+NZqtvRN0HCrHBMih9SA/SMY46TFRbBS2zxuv8+xyc+t2KTQ3FYLI0WRNTw 2wvvSir6Zbf3m2aBHqaLttus6eWVWEGcIm66hVHnBUywTHCJNhMf0IFbT1oxDK6xYAF/ rJTy2dg53he5lYflsiYY4dfjxIBtX3qSoINh6s6i2b/fdKkZ22veWHrLD8ogShN0ZEt2 ChcTokPmr9OVnxl2xx8Qwf6poJFTRtj3C1MrUQ3c1km2Rz1VRHoJMd1k8nh7KVYA8jaa TngQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711416547; x=1712021347; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mt57Ph8Spha2gi0W8Ru2CGiLSoI8PKHWGavfwJ1Z2V8=; b=TYIZVipuBnv83aCJbEeqEpcezYLdmrls2nPHzBY69znNHxBmLk3xXpaK2xy6VWyEwC y2GklVq7g87CfxuBaI0UVkgrheIOxdlDLt4hby4RR3Gku6GQwU9eOioqmkBexdIhk4HU vTkrvxhfpcWogf+6zfMd6hnVQffUbUtd7M0tLrLUQiwYtfMVx2I9BDavPDaO/PVN5QUa cNv7Dn3ChU3Wq2l/CoULgen1iTyo+m0dZwtyHSupEBeCF8K1b1GxMoKW+uoW3/78uHSC AvS7+9fbFBCB9fE7yZ44uIK/bi86MbSPbPxzLBxeCHhgWFJNg2aveqgAKdx9PlV2wGzP CsUg== X-Gm-Message-State: AOJu0YypywohiyKV5qY3kcCT8IpRSFTnLyEMsfK0j3YprU6vtfT08/0E 7CeYqAU1dprx5boS9C9tHSV74JbsYDU2IYYHH19A1P5zSnzlRcF/2eoTb5O4 X-Google-Smtp-Source: AGHT+IGMxbgDwmmaLdNjduIi07La1kWccEKHI1gnVXfaGflObSvGH8YNlBXYD4Cy+ksUK8ytRidtlg== X-Received: by 2002:a05:6a21:a581:b0:1a3:30a8:2ad6 with SMTP id gd1-20020a056a21a58100b001a330a82ad6mr8447171pzc.10.1711416546980; Mon, 25 Mar 2024 18:29:06 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id a23-20020a1709027d9700b001e0d0929c77sm1535784plm.90.2024.03.25.18.29.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 18:29:06 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 25 Mar 2024 22:28:52 -0300 Message-ID: <20240326012852.1014-1-jamrial@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mov: don't use cur_item_id as array index X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: James Almer --- libavformat/mov.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index f954b924a0..9f2ea97a5b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -8085,7 +8085,6 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) memset(c->heif_item + c->nb_heif_item, 0, sizeof(*c->heif_item) * (item_count - c->nb_heif_item)); c->nb_heif_item = FFMAX(c->nb_heif_item, item_count); - c->cur_item_id = 0; av_log(c->fc, AV_LOG_TRACE, "iloc: item_count %d\n", item_count); for (int i = 0; i < item_count; i++) { @@ -8127,7 +8126,7 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) return atom.size; } -static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) +static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom, int idx) { AVBPrint item_name; int64_t size = atom.size; @@ -8164,21 +8163,19 @@ static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_skip(pb, size); if (ret) - av_bprint_finalize(&item_name, &c->heif_item[c->cur_item_id].name); - c->heif_item[c->cur_item_id].item_id = item_id; - c->heif_item[c->cur_item_id].type = item_type; + av_bprint_finalize(&item_name, &c->heif_item[idx].name); + c->heif_item[idx].item_id = item_id; + c->heif_item[idx].type = item_type; switch (item_type) { case MKTAG('a','v','0','1'): case MKTAG('h','v','c','1'): - ret = heif_add_stream(c, &c->heif_item[c->cur_item_id]); + ret = heif_add_stream(c, &c->heif_item[idx]); if (ret < 0) return ret; break; } - c->cur_item_id++; - return 0; } @@ -8210,14 +8207,13 @@ static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) memset(c->heif_item + c->nb_heif_item, 0, sizeof(*c->heif_item) * (entry_count - c->nb_heif_item)); c->nb_heif_item = FFMAX(c->nb_heif_item, entry_count); - c->cur_item_id = 0; for (int i = 0; i < entry_count; i++) { MOVAtom infe; infe.size = avio_rb32(pb) - 8; infe.type = avio_rl32(pb); - ret = mov_read_infe(c, pb, infe); + ret = mov_read_infe(c, pb, infe, i); if (ret < 0) return ret; } -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".