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 0E5FA48416 for ; Tue, 2 Apr 2024 12:05:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 43BD668CEE7; Tue, 2 Apr 2024 15:05:01 +0300 (EEST) Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0B70D68BDE1 for ; Tue, 2 Apr 2024 15:04:54 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6eaf1005fcaso2026795b3a.3 for ; Tue, 02 Apr 2024 05:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712059491; x=1712664291; darn=ffmpeg.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=13eMVuKQjhWRsXU5xn5vbmGcjYsl8SGxymycjTxR8eA=; b=GG7A67CpAma7/3+HgqfvJBOT5WKTu7GQtNC4pXsdVP9frzxItD+gFkPP9E3lui6ER0 Tx+MEBfbTE+Dl+4IVK1vFdw8/oJMr0grl5PApr8RzeNIZT/WSNflgHAweVR+VPsq3iRr MJr/wB4QD/8ArRTyTjw/WHYY4Y2XTi3xveXWWfyCdw+w38fI0FHCVOnbJed3Kll/+LMD Pf1W71kQqYz2b6c0RHJCDOQv5kR/CyPHsE4AMuBFgbpNxlVYpboqWep9WDhBj+zNip9a qFmF1PZ53fyijmrPrrbO+MmNJIn/NhhwlRgie1GbnCtFTyHegHeywm0SoUftrecCZOGI mJFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712059491; x=1712664291; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=13eMVuKQjhWRsXU5xn5vbmGcjYsl8SGxymycjTxR8eA=; b=OfKadZCEGa4LM4RjV30gmDvPWOI9iwrQ/YsfkUgeciEChgEh3HehRgRHuPED1LRVCm SsmXlXPkN3Ya3fNDC/MbHtXQDBJlNFiSk21IYgbMwvA7QCPtlD6aKFT3rECTVnvZlXVp fu2fkJlNCVtsCQJUFNVPd/KnIRDZrHuEmarI8iPHWva5PZYcuoTm5y7ed3oV1VsLfExw 4nv7sve0dduB7OjRzPDDbNKHppYIA2vwqBGWmNAOsfoFBWMVw76iHGLkPKKqOIkHuXyq EYhrqcGD61ghkA7cfL9SiC6s4XlJ18/6ZgXycVyZ3lajGekQ7GYJ+dI2HWvd7KV+Igxa t2bA== X-Gm-Message-State: AOJu0YwpW4Tw8WUKX6zn19eV4zgA9F92U0cWuNxp8BXNWMwrl1J8bA3l mvn+qA9NYLEIAR1dk8BQ5lufxrfkrx9Do0PERXZR7rltN36wbYNIPuwaMttG X-Google-Smtp-Source: AGHT+IHllEc2LsoLU728dYfrfjG/x90b4TYosPYbcKzGvlbK1p+Cf2byH/AWZfra2Jl4WHKfUhrGFQ== X-Received: by 2002:a05:6a00:3901:b0:6ea:ab45:6605 with SMTP id fh1-20020a056a00390100b006eaab456605mr14592795pfb.4.1712059490952; Tue, 02 Apr 2024 05:04:50 -0700 (PDT) Received: from [192.168.0.15] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id q24-20020a656858000000b005f077dce0f6sm8406684pgt.31.2024.04.02.05.04.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Apr 2024 05:04:50 -0700 (PDT) Message-ID: Date: Tue, 2 Apr 2024 09:05:03 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240402031800.7159-1-jamrial@gmail.com> <20240402031800.7159-3-jamrial@gmail.com> Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/mov: fix the entry count overflow check in the keys atom 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 4/2/2024 12:30 AM, Andreas Rheinhardt wrote: > James Almer: >> Signed-off-by: James Almer >> --- >> libavformat/mov.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/mov.c b/libavformat/mov.c >> index a935ef7326..9fca402896 100644 >> --- a/libavformat/mov.c >> +++ b/libavformat/mov.c >> @@ -5025,7 +5025,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom) >> avio_skip(pb, 4); >> count = avio_rb32(pb); >> atom.size -= 8; >> - if (count > UINT_MAX / sizeof(*c->meta_keys) - 1) { >> + if (count + 1LL > UINT_MAX / sizeof(*c->meta_keys)) { >> av_log(c->fc, AV_LOG_ERROR, >> "The 'keys' atom with the invalid key count: %"PRIu32"\n", count); >> return AVERROR_INVALIDDATA; > > What is supposed to be wrong here in the first place? The only thing I > can think of is the case in which sizeof(*c->meta_keys) is > UINT_MAX, > in which case the rhs would wrap around. But I don't think that is what > you meant given that sizeof(*c->meta_keys) == sizeof(char*). > Anyway, a simpler check that works even if sizeof(*c->meta_keys) were > insanely large is "count >= UINT_MAX / sizeof(*c->meta_keys)". I misread the check, so there's nothing wrong with it. But I'll apply that suggestion of yours in any case since it's simpler than the current one. _______________________________________________ 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".