From owner-svn-src-all@FreeBSD.ORG Sat May 11 05:54:06 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id DC69F4D0 for ; Sat, 11 May 2013 05:54:06 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-da0-x22d.google.com (mail-da0-x22d.google.com [IPv6:2607:f8b0:400e:c00::22d]) by mx1.freebsd.org (Postfix) with ESMTP id B50D196C for ; Sat, 11 May 2013 05:54:06 +0000 (UTC) Received: by mail-da0-f45.google.com with SMTP id w3so2619309dad.18 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=MFlRIgf45HFajMPZQPVRKY/yyDyE0oA55Pw75eEQmHX91T3+lXVzCbhxF6ikKXcekB aW/xMU/dgYXAkjccERqvif+kORl3Ie3pPNuCS38TSQcVdbY8TBy5NrsiIhbvQIOhOOlT IvQ1N1OOcbUXVejqld0ijUEyiCpuYViujPKEF1O+G6KolPey8hlw/Wx/XO9Qr0jpcYUg rr7iRUf7AUjsGJnbJQk0x3DRgPECTA8Uj2M3z8/lfbSuSBFX2bgwYQZNv8q4h5DL/+M9 6Yh3vthqctkOkQPU+nEose2S3uYJ6gOOiOiGYkVVIkn11dh5vceKM0VE+TUvrKRPhsgs tqzQ== 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: ALoCoQnNQCMCmHfLYLp+7bOOWM16Nbjevr2GaYEmm16XvwwcdRtNOA6hGBA6/hONNQ2aWJEFhAVY Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" 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