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 4EBB94B62A for ; Wed, 10 Jul 2024 15:52:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A60CF68DB4F; Wed, 10 Jul 2024 18:52:44 +0300 (EEST) Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3DBDD68D9A5 for ; Wed, 10 Jul 2024 18:52:38 +0300 (EEST) Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5c47ad9967cso3446954eaf.2 for ; Wed, 10 Jul 2024 08:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720626755; x=1721231555; 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=bh7wLHbIKmKOdmcyR+bvZNJVwd6aR4Anf+mq7Ceq4wE=; b=Y9Ly2jbsp/B4IXX+uggIibMKpRbsWOJnf13UKj82VHqJaGJDi+iCasvQG2jj5aO/6/ NWKi22+QEvyrAtlnOBjo+f6P2Obr0nMCKqpevFCiYp/Qg7DOBKIQd7920xdYx4QNf2g+ hpkPlWbOpEz90fiXInXxyC4ev/jAw7bmRkojeNXvgIi58at/8zWQKqmR4fP78kWwNRod tn0VElNdYe25ED4omQrx9EeLORqQXD0i4rmqL9LptJHzmaXxhpm+vyf9K7KyRoBH7nmT 2gELz15d7Js07Xio9V05RZDhkvucwhipfbMPWIm26OUCzm6+ZOZo9nPVd1WTA1/Ujxh1 Ow9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720626756; x=1721231556; 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=bh7wLHbIKmKOdmcyR+bvZNJVwd6aR4Anf+mq7Ceq4wE=; b=smxtIK/zhWgi85wb8tVUr9gFhHBcmLz2/SdVoVNg8m+7jWsPh476MNrQWZ4WLr+F9M Q6mjlmsTavVPGnSRY0XOxx08P/m1HTwvrGBnXuyO1kesEHwvZpgfP0VE0/ZbSOBnsa4J FF0UNNm4agSzqdChlFynk7E+0wkBqDsD1xkvvEv9gt0zeSsWDVcb7SnbuQggvKTX8WcC f0OYdeGyMcH1IDX6fmfZxqFu66cqbQOuyQyYqoaDOA1toF4SMugyZYkrAAWmIoTrDTgY FNHkfoDzRXZSjRxfMV4SN71WRizg8+lC+wRNtsBIdjvCaRf2k49wWKL7MYDr+tHN4TqZ sYQQ== X-Gm-Message-State: AOJu0YyeCflaTEx8haM9oxh4ZH+Op6AD0Z/L26iJq0vaRRkZSzFkhTtU lqoLs5krwLmTqYsSCyeE1RgRc3cM7omqETBDFKZMhb0JJyUB3MSQsTl+JQ== X-Google-Smtp-Source: AGHT+IF7TaTU1YJIA7BGy4Q24zIjR4/Z1uMWE6RrOnUz4dY2XVKmTX8jNxIn7KBHDzHsM81pE41ydQ== X-Received: by 2002:a05:6359:6291:b0:1aa:ac10:bfc3 with SMTP id e5c5f4694b2df-1aade0f7d1cmr457107555d.11.1720626755394; Wed, 10 Jul 2024 08:52:35 -0700 (PDT) Received: from [192.168.0.16] ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-77d682b461esm2602962a12.81.2024.07.10.08.52.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jul 2024 08:52:34 -0700 (PDT) Message-ID: Date: Wed, 10 Jul 2024 12:52:39 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240710154956.3225816-1-michael@niedermayer.cc> Content-Language: en-US From: James Almer In-Reply-To: <20240710154956.3225816-1-michael@niedermayer.cc> Subject: Re: [FFmpeg-devel] [PATCH v2] avutil/imgutils: av_image_check_size2() ensure width and height fit in 32bit 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 7/10/2024 12:49 PM, Michael Niedermayer wrote: > width and height > 32bit is not supported and its easier to check in a central place > > Signed-off-by: Michael Niedermayer > --- > libavutil/imgutils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c > index d2463815637..b738cff37c2 100644 > --- a/libavutil/imgutils.c > +++ b/libavutil/imgutils.c > @@ -298,7 +298,7 @@ int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enu > stride = 8LL*w; > stride += 128*8; > > - if ((int)w<=0 || (int)h<=0 || stride >= INT_MAX || stride*(uint64_t)(h+128) >= INT_MAX) { > + if (w==0 || h==0 || w > INT32_MAX || h > INT32_MAX || stride >= INT_MAX || stride*(uint64_t)(h+128) >= INT_MAX) { You could do stride*(h+128ULL) while at it, to make the line more readable. > av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h); > return AVERROR(EINVAL); > } _______________________________________________ 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".