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 6B97B428D9 for ; Tue, 5 Apr 2022 19:39:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 39B4E68B186; Tue, 5 Apr 2022 22:39:08 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 372D068AE8D for ; Tue, 5 Apr 2022 22:39:02 +0300 (EEST) Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 3A1C31C0004 for ; Tue, 5 Apr 2022 19:39:00 +0000 (UTC) Date: Tue, 5 Apr 2022 21:39:00 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220405193900.GW2829255@pb2> References: <20220401104608.10193-1-michael@niedermayer.cc> <20220401104608.10193-2-michael@niedermayer.cc> <164915278455.21047.416796164909893337@lain.red.khirnov.net> MIME-Version: 1.0 In-Reply-To: <164915278455.21047.416796164909893337@lain.red.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/matroskadec: avoid integer overflows in SAR computation 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: multipart/mixed; boundary="===============6318488506578700897==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6318488506578700897== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="B/C9xwi7wdTEpUYu" Content-Disposition: inline --B/C9xwi7wdTEpUYu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 05, 2022 at 11:59:44AM +0200, Anton Khirnov wrote: > Quoting Michael Niedermayer (2022-04-01 12:46:08) > > This ignores >64bit > > Alternatively we could support that if it occurs in reality > >=20 > > Fixes: negation of -9223372036854775808 > > Fixes: integer overflows > > Fixes: 46072/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-= 5029840966778880 > >=20 > > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz= /tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/matroskadec.c | 13 ++++++++----- > > 1 file changed, 8 insertions(+), 5 deletions(-) > >=20 > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > > index d97fc33d44..069fba6cf7 100644 > > --- a/libavformat/matroskadec.c > > +++ b/libavformat/matroskadec.c > > @@ -2886,11 +2886,14 @@ static int matroska_parse_tracks(AVFormatContex= t *s) > > mkv_stereo_mode_display_mul(track->video.stereo_mode, = &display_width_mul, &display_height_mul); > > =20 > > if (track->video.display_unit < MATROSKA_VIDEO_DISPLAYUNIT= _UNKNOWN) { > > - av_reduce(&st->sample_aspect_ratio.num, > > - &st->sample_aspect_ratio.den, > > - st->codecpar->height * track->video.display_= width * display_width_mul, > > - st->codecpar->width * track->video.display_= height * display_height_mul, > > - INT_MAX); > > + if (track->video.display_width && track->video.display= _height && > > + st->codecpar->height * (int64_t)display_width_mul = < INT64_MAX / track->video.display_width && > > + st->codecpar->width * (int64_t)display_height_mul= < INT64_MAX / track->video.display_height) >=20 > Why not move display_{width,height}_mul to the other side of the > comparison and avoid wordsize assumptions? This is header parsing, so > division performance impact should be negligible. will do thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament. --B/C9xwi7wdTEpUYu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYkya0AAKCRBhHseHBAsP q4crAJ98JyFPFRPssUzqp5nWdaFloBLOvwCfeIVGXuNDY0+TAfX30xB6ppaV3c0= =aSqh -----END PGP SIGNATURE----- --B/C9xwi7wdTEpUYu-- --===============6318488506578700897== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============6318488506578700897==--