From owner-svn-src-head@FreeBSD.ORG Sat May 11 05:54:05 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id EC8E84CF for ; Sat, 11 May 2013 05:54:05 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx1.freebsd.org (Postfix) with ESMTP id C3EE096B for ; Sat, 11 May 2013 05:54:05 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id bi5so3350208pad.8 for ; Fri, 10 May 2013 22:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=HOMSDtYF6sgbUW38bGsXA/ROZP97MkEuzVyAlaHs6/Y=; b=kSBCCJZsu7QmGdYAinRYhPB4aJ4TFlyIUtAFcjPpTGs/2FNVgECE5WpvJe3cK6Bpf1 oUpSSAlGQkHnDU0irGXiirz3fP6wX3Oo/Kjthx+dUF2uCOfceb4J94Nuc8452xcLAcIw cspxq17clpVi/jTa71Z6G3ZtXAfQsY9UFcxq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :x-gm-message-state; bh=HOMSDtYF6sgbUW38bGsXA/ROZP97MkEuzVyAlaHs6/Y=; b=MZ7E1tJeBPY2m7FPfT/H25VqVQ/qvTrQckSPYD3SxIVvl7Rdn98Wbvs5W7b1s2Pkr8 6MpRtO23oo8FUxeAQpBq4QjtYaOLTScTvLEyPY+IWkazzEwSoWbUEn4zDmB14NomX0Ud utEBW+6fDttICoWpeFGbFugTmwM+2bBAmDJyYEHf//vKPKzz1wycfRaZNeCg6Q+14nMx 1E3tr8Tth5kw3BR2tCzWSOf6Yl0EFJGTvd19zCJZTHShfmW5NGYg4pUSgqR91GbCo0Da BEXC+tK06DBZF1+jc7Mm3CRe3ruM6d56awchaZOdKWyTQp3ixSoc9X0H8jU7OfudPCWK RwoA== X-Received: by 10.68.247.68 with SMTP id yc4mr20116156pbc.54.1368251644865; Fri, 10 May 2013 22:54:04 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.66.159.97 with HTTP; Fri, 10 May 2013 22:53:34 -0700 (PDT) In-Reply-To: References: <201305100423.r4A4N44u094726@svn.freebsd.org> From: Eitan Adler Date: Sat, 11 May 2013 01:53:34 -0400 X-Google-Sender-Auth: 4JVCRVDamF97sSG5W7iMvces-80 Message-ID: Subject: Re: svn commit: r250432 - head/usr.bin/split To: Benjamin Kaduk Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQnVfT8MDymS0mA8w7Hx0BZjXyc4PLMNrxznHt9SmCuco3vJ7RhO/gmFZIVeqxykEAwALgiS Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 May 2013 05:54:06 -0000 On 10 May 2013 13:05, Benjamin Kaduk wrote: > This check relies on signed integer overflow, which is undefined behavior. > Furthermore, even if one assumes a non-evil compiler and two's complement > representation, this check fails for pattlen == 10. > 10**9 is representable as both a signed and unsigned 32-bit integer, but > 10**10 overflows both variants and ends up in the positive side of the > signed space. > > With a fixed number of bases to be exponentiated here (10 or 26), it would > seem much simpler to do the logarithm manually out-of-band and just hardcode > a check on sufflen (noting that maxfiles is of type long which can be either > 32 or 64 bits). ... Good point. I did not look closely at this code and assumed it was correct. I shall fix it. -- Eitan Adler Source, Ports, Doc committer Bugmeister, Ports Security teams