From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NhMpb-00082v-Pv for mharc-grub-devel@gnu.org; Tue, 16 Feb 2010 07:47:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NhMpZ-00082j-Cn for grub-devel@gnu.org; Tue, 16 Feb 2010 07:47:09 -0500 Received: from [140.186.70.92] (port=56655 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NhMpX-00082b-Mz for grub-devel@gnu.org; Tue, 16 Feb 2010 07:47:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NhMpW-0005F6-VJ for grub-devel@gnu.org; Tue, 16 Feb 2010 07:47:07 -0500 Received: from mail-fx0-f215.google.com ([209.85.220.215]:34139) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NhMpW-0005F1-NU for grub-devel@gnu.org; Tue, 16 Feb 2010 07:47:06 -0500 Received: by fxm7 with SMTP id 7so6255715fxm.8 for ; Tue, 16 Feb 2010 04:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type; bh=erVdc+C8bWT3u+209riJkPUXOoRTxAmdRVJI4nhp55o=; b=TL7AnanHwpIvnpsg1CpYf+zYwBRyGxaD8fzmoCqp+Sh5pAIsLwd8veflVGKHGXrYec SjsYQw8VpuCMO2ka+SVErSkSw7dIo0EFHH8n1v+BlnxTtI7Nd1PtQ/4PTHbaY9In6imp L6psteNgiLDBPbB2jVauYJnPQK4CrHA6bHbr8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; b=miGDJWYw/K+i3oZFMLm6HEZ7TYlM1do0tH0bvgj+3i5d5KMxga1wX5gIv6yZZSMqd5 BjiACmyrVK7WUvnDxYY6/7dJAbXhjcD82f3yFVN987kqJyaFHjZCrfaaGzjjnFGlfbak TaWurGLwHJcd5Ckr8zOsquLdBVeqe0UjJddtY= Received: by 10.87.69.17 with SMTP id w17mr11453409fgk.41.1266324425717; Tue, 16 Feb 2010 04:47:05 -0800 (PST) Received: from debian.bg45.phnet ([81.62.76.105]) by mx.google.com with ESMTPS id e3sm8744375fga.21.2010.02.16.04.47.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 16 Feb 2010 04:47:04 -0800 (PST) Message-ID: <4B7A93BD.9010607@gmail.com> Date: Tue, 16 Feb 2010 13:46:53 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) MIME-Version: 1.0 To: The development of GNU GRUB References: <20100214000510.GA10702@pina.cat> In-Reply-To: <20100214000510.GA10702@pina.cat> X-Enigmail-Version: 0.95.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig0972A5135CC988615A7751C9" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: avoid possible overflow? X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2010 12:47:09 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0972A5135CC988615A7751C9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Carles Pina i Estany wrote: > Hello, > > The common pattern when doing a search by bisection is something like: > + current =3D min + (max - min) / 2; > > Instead of the first natural idea: > - current =3D (max + min) / 2; > > To avoid overflows. > > In gettext/gettext.c it's used in the "incorrect" way. It's not a big > problem since would happen only with .mo files with lot of strings, lik= e > number that int represents in that architecture divided by 2 (aprox > aprox.). > > See the attached file for a patch if we want to patch. > =20 You forgot to make the same change before the loop. But actually it doesn't matter because overflow in this statement: internal_position =3D offsettranslation + position * 8; is reached well before the overflow in bisecting. Anyway this mattersonly for >4GiB files and unless we put videos in .po I don't see how this limit would be reached. So I prefer readability and would reject this patch. > Else I would at least add a comment that we simplified because we > consider that will not happen. > > Thanks, > > =20 > -----------------------------------------------------------------------= - > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enig0972A5135CC988615A7751C9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iF4EAREKAAYFAkt6k8MACgkQNak7dOguQgnMxQEAtlM+Q3Nty11LM1jPHcXTbUSp UVJ7E4SXsovgJcW0x+QBALt7PrywBZoeMz9wOf0TWNjQD91p66f+AlV/W9nx/Cjd =GVkr -----END PGP SIGNATURE----- --------------enig0972A5135CC988615A7751C9--