From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 01 22:41:31 2013 Received: (at submit) by debbugs.gnu.org; 2 Jun 2013 02:41:31 +0000 Received: from localhost ([127.0.0.1]:47131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UiyEc-0004gE-Fn for submit@debbugs.gnu.org; Sat, 01 Jun 2013 22:41:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42270) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UiyEW-0004fe-3f for submit@debbugs.gnu.org; Sat, 01 Jun 2013 22:41:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiyCj-0008Or-G1 for submit@debbugs.gnu.org; Sat, 01 Jun 2013 22:39:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50,USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiyCj-0008On-Cs for submit@debbugs.gnu.org; Sat, 01 Jun 2013 22:39:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiyCf-0007ij-PN for bug-coreutils@gnu.org; Sat, 01 Jun 2013 22:39:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiyCc-0008NV-Eh for bug-coreutils@gnu.org; Sat, 01 Jun 2013 22:39:29 -0400 Received: from mx.meyering.net ([88.168.87.75]:57927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiyCc-0008NL-2u for bug-coreutils@gnu.org; Sat, 01 Jun 2013 22:39:26 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 79B4E6022B; Sun, 2 Jun 2013 04:39:24 +0200 (CEST) From: Jim Meyering To: bug-coreutils@gnu.org Subject: [PATCH] od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t Date: Sun, 02 Jun 2013 04:39:24 +0200 Message-ID: <87d2s5dyn7.fsf@rho.meyering.net> Lines: 139 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit Cc: Rich Burridge X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Rich reported this bug privately. Here's a proposed patch. I could have fixed the underlying problem with explicit casts to a wider type (including floating point types), but this seemed cleanest, if perhaps a little too subtle. I'd rather not write a comment in each of three places, and didn't really want to factor out a 3-input function just to compute each next_pad value. Along the way, I noticed that an unreasonably large width caused trouble, but I'm not inclined to worry about it: $ : | od -An -a -w$(echo 2^32-1|bc) od: memory exhausted >From 19a4227793820f74bd6ca503ded3fafe65425eff Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 1 Jun 2013 19:20:06 -0700 Subject: [PATCH] od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t * src/od.c (PRINT_FIELDS): Declare "i" to be of type uintmax_t, so that the numerator in the expression for "next_pad" does not overflow. (print_named_ascii): Likewise. (print_ascii): Likewise. Bug introduced via commit v6.12-42-g20c0b87. * tests/misc/od.pl: Exercise each of the three affected code paths. * NEWS (Bug fixes): Mention it. Reported by Rich Burridge. --- NEWS | 4 ++++ THANKS.in | 1 + src/od.c | 6 +++--- tests/misc/od.pl | 7 +++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 721e05b..cad5eee 100644 --- a/NEWS +++ b/NEWS @@ -16,10 +16,14 @@ GNU coreutils NEWS -= *- outline -*- mkdir, mkfifo, and mknod now work better when creating a file in a direc= tory with a default ACL whose umask disagrees with the process's umask, on a system such as GNU/Linux where directory ACL umasks override process uma= sks. [bug introduced in coreutils-6.0] + od -wN with N larger than 64K on a system with 32-bit size_t would + print approximately 2*N bytes of extraneous padding. + [Bug introduced in coreutils-7.0] + tail --retry -f now waits for the files specified to appear. Before, ta= il would immediately exit when such a file is inaccessible during the initi= al open. [This bug was introduced when inotify support was added in coreutils-7.5] diff --git a/THANKS.in b/THANKS.in index 67b60b9..f399d77 100644 --- a/THANKS.in +++ b/THANKS.in @@ -519,10 +519,11 @@ Rainer Orth ro@TechFak.Uni-Bi= elefeld.DE Ralf W. Stephan stephan@tmt.de Ralph Loader loader@maths.ox.ac.uk Rasmus Borup Hansen rbh@intomics.com Raul Miller moth@magenta.com Ra=FAl N=FA=F1ez de Arenas Coronado raul@pleyades.net +Rich Burridge rich.burridge@oracle.com Richard A Downing richard.downing@bcs.org.uk Richard Braakman dark@xs4all.nl Richard Dawe rich@phekda.freeserve.co.uk Richard J. Rauenzahn rrauenza@hairball.cup.hp.com Richard Neill rn214@hermes.cam.ac.uk diff --git a/src/od.c b/src/od.c index e8cab46..1c23401 100644 --- a/src/od.c +++ b/src/od.c @@ -398,11 +398,11 @@ and so on for G, T, P, E, Z, Y.\n\ static void \ N (size_t fields, size_t blank, void const *block, \ char const *FMT_STRING, int width, int pad) \ { \ T const *p =3D block; \ - size_t i; \ + uintmax_t i; = \ int pad_remaining =3D pad; \ for (i =3D fields; blank < i; i--) \ { \ int next_pad =3D pad * (i - 1) / fields; \ int adjusted_width =3D pad_remaining - next_pad + width; \ @@ -454,11 +454,11 @@ static void print_named_ascii (size_t fields, size_t blank, void const *block, const char *unused_fmt_string _GL_UNUSED, int width, int pad) { unsigned char const *p =3D block; - size_t i; + uintmax_t i; int pad_remaining =3D pad; for (i =3D fields; blank < i; i--) { int next_pad =3D pad * (i - 1) / fields; int masked_c =3D *p++ & 0x7f; @@ -485,11 +485,11 @@ static void print_ascii (size_t fields, size_t blank, void const *block, const char *unused_fmt_string _GL_UNUSED, int width, int pad) { unsigned char const *p =3D block; - size_t i; + uintmax_t i; int pad_remaining =3D pad; for (i =3D fields; blank < i; i--) { int next_pad =3D pad * (i - 1) / fields; unsigned char c =3D *p++; diff --git a/tests/misc/od.pl b/tests/misc/od.pl index 0649b1c..fb579aa 100755 --- a/tests/misc/od.pl +++ b/tests/misc/od.pl @@ -55,10 +55,17 @@ my @Tests =3D # Ensure that od -j doesn't fseek across a nonempty file in /proc, # even if the kernel reports that the file has stat.st_size =3D 0. ['j-proc', "-An -c -j $proc_file_byte_count $proc_file", {IN=3D>{f2=3D>'e'}}, {OUT=3D>" e\n"}], + + # Ensure that a large width does not cause trouble. + # From coreutils-7.0 through coreutils-8.21, these would print + # approximately 128KiB of padding. + ['wide-a', '-a -w65537 -An', {IN=3D>{g=3D>'x'}}, {OUT=3D>" x\n"}], + ['wide-c', '-c -w65537 -An', {IN=3D>{g=3D>'x'}}, {OUT=3D>" x\n"}], + ['wide-x', '-tx1 -w65537 -An', {IN=3D>{g=3D>'B'}}, {OUT=3D>" 42\n"}], ); my $save_temps =3D $ENV{DEBUG}; my $verbose =3D $ENV{VERBOSE}; -- 1.8.3.101.g727a46b From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 02 11:18:02 2013 Received: (at 14530) by debbugs.gnu.org; 2 Jun 2013 15:18:02 +0000 Received: from localhost ([127.0.0.1]:47947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjA2j-00045E-QU for submit@debbugs.gnu.org; Sun, 02 Jun 2013 11:18:02 -0400 Received: from mail3.vodafone.ie ([213.233.128.45]:28544) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjA2g-00044f-FW for 14530@debbugs.gnu.org; Sun, 02 Jun 2013 11:17:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjgDAF5gq1FtTT3N/2dsb2JhbAANTb9MgmkDAYESgxcBAQEDATIBRgULCw0LCRYPCQMCAQIBRQYNAQcBAReHbKgZkXWNcFhfB4NYA51/g1qIfYE4gWg Received: from unknown (HELO [192.168.1.79]) ([109.77.61.205]) by mail3.vodafone.ie with ESMTP; 02 Jun 2013 16:16:04 +0100 Message-ID: <51AB61B4.6040005@draigBrady.com> Date: Sun, 02 Jun 2013 16:16:04 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#14530: [PATCH] od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t References: <87d2s5dyn7.fsf@rho.meyering.net> In-Reply-To: <87d2s5dyn7.fsf@rho.meyering.net> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 14530 Cc: 14530@debbugs.gnu.org, Rich Burridge X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 06/02/2013 03:39 AM, Jim Meyering wrote: > Rich reported this bug privately. > > Here's a proposed patch. > I could have fixed the underlying problem with > explicit casts to a wider type (including floating point types), > but this seemed cleanest, if perhaps a little too subtle. > I'd rather not write a comment in each of three places, > and didn't really want to factor out a 3-input function > just to compute each next_pad value. Since this is just a local variable, I think the proposed solution is fine. > Along the way, I noticed that an unreasonably large width > caused trouble, but I'm not inclined to worry about it: > > $ : | od -An -a -w$(echo 2^32-1|bc) > od: memory exhausted Yes this is an artificial limit, but in such and edge case as I don't think it's worth complicating the code for. +1 thanks, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 02 12:33:50 2013 Received: (at 14530) by debbugs.gnu.org; 2 Jun 2013 16:33:50 +0000 Received: from localhost ([127.0.0.1]:47977 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjBE5-0007Tp-Nq for submit@debbugs.gnu.org; Sun, 02 Jun 2013 12:33:50 -0400 Received: from mx.meyering.net ([88.168.87.75]:56844) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UjBE3-0007TP-PC for 14530@debbugs.gnu.org; Sun, 02 Jun 2013 12:33:48 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id EBC8660179; Sun, 2 Jun 2013 18:31:54 +0200 (CEST) From: Jim Meyering To: =?iso-8859-1?Q?P=E1draig?= Brady Subject: Re: bug#14530: [PATCH] od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_t In-Reply-To: <51AB61B4.6040005@draigBrady.com> (=?iso-8859-1?Q?=22P=E1drai?= =?iso-8859-1?Q?g?= Brady"'s message of "Sun, 02 Jun 2013 16:16:04 +0100") References: <87d2s5dyn7.fsf@rho.meyering.net> <51AB61B4.6040005@draigBrady.com> Date: Sun, 02 Jun 2013 18:31:54 +0200 Message-ID: <8761xwcw3p.fsf@rho.meyering.net> Lines: 34 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 14530 Cc: 14530@debbugs.gnu.org, Rich Burridge X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.7 (----) close 14530 thanks P=E1draig Brady wrote: > On 06/02/2013 03:39 AM, Jim Meyering wrote: >> Rich reported this bug privately. >> >> Here's a proposed patch. >> I could have fixed the underlying problem with >> explicit casts to a wider type (including floating point types), >> but this seemed cleanest, if perhaps a little too subtle. >> I'd rather not write a comment in each of three places, >> and didn't really want to factor out a 3-input function >> just to compute each next_pad value. > > Since this is just a local variable, > I think the proposed solution is fine. > > >> Along the way, I noticed that an unreasonably large width >> caused trouble, but I'm not inclined to worry about it: >> >> $ : | od -An -a -w$(echo 2^32-1|bc) >> od: memory exhausted > > Yes this is an artificial limit, but in such > and edge case as I don't think it's worth > complicating the code for. > > +1 Thanks for the review. Pushed. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 09 17:43:21 2018 Received: (at control) by debbugs.gnu.org; 9 Oct 2018 21:43:21 +0000 Received: from localhost ([127.0.0.1]:42664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g9zmj-0005tk-I2 for submit@debbugs.gnu.org; Tue, 09 Oct 2018 17:43:21 -0400 Received: from mail-io1-f52.google.com ([209.85.166.52]:35399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g9zmh-0005tS-Fu for control@debbugs.gnu.org; Tue, 09 Oct 2018 17:43:19 -0400 Received: by mail-io1-f52.google.com with SMTP id w11-v6so2388168iob.2 for ; Tue, 09 Oct 2018 14:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=12oaNd4Y/d8uNOkT/vNiJW3/itOloT26xPt9/7MfbBE=; b=tbW7aBlhF3AQXX1VncVlMlohWg5bYIThTcYC3JBSB9zXNM838HyV8wSJJAJz+VpnAN wSQqhAa8eHdMPvUB7yZJ7oz3DmkSVLbx2Jee/ro8y44GqNOLxQfrGe0Myap1ysyFTbEb 7IMoBwfTFNAva8G9dLIsAEDI4r34sTkZEeHXN7xnj9Lh5RQqlS2eea+jH2Vq/3Xd8uHL btlhLIaCqQAsf1ucLHKkW3KgSb2cLNeqBLhoyMCgUZYeqTOLuDMpHHJ4OKOK5iFbuTMl b79sbAIyJjy8ap1nf3n42e5KQI8yPBDKq+AunM0elKmPGw4IaMged5UaMP3axIn5CJBH GGGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=12oaNd4Y/d8uNOkT/vNiJW3/itOloT26xPt9/7MfbBE=; b=S3/tEmw+4oA+ER4KreP6e8wCUwYTTxKXxid2x77V8r9AGa2Xc0DtLxWsShpVAEs79S R6stvvGJY2LeGgV4fo51hW/JNRu0ATeoZ7kXL0tiStxLDlwW/iYjzPlpwXcGV3rWIS1N XT6tHREjyXpwTCgYHHBRpPFFo4CMbSWIdgUvfWBH9b6XTd1gqtvoAF+oTo14SPTsqpko vgvuXL9Plvli9BzPkMHbNKLwmWhyG1gZ51517vJ9IeEt76dN8w8IZ53pHWU+//2jG2W6 LOdHfxe8lmsELK4j4ID8fez2aM7K1QxpXSpsEwbBvxt21vUB+p2IREa9UveXh5M43i/n r8Vg== X-Gm-Message-State: ABuFfoje/UBwWTO6ZGDYSaPMKahRg9wBZ2H2x0Dc9eXDw8miPuPgu1aI l9eSreQLxdjqg+kOH4e6zbnxnXpDht8= X-Google-Smtp-Source: ACcGV61zm4FGJgkjX6U0WgM3eCRgerxLjnPs2WtOZsmvzMZc628oCVzRwBdLcRsdUkkcwWjlGJMmVw== X-Received: by 2002:a6b:1701:: with SMTP id 1-v6mr888589iox.48.1539121393404; Tue, 09 Oct 2018 14:43:13 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id i81-v6sm6942692iti.36.2018.10.09.14.43.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 14:43:12 -0700 (PDT) To: control@debbugs.gnu.org From: Assaf Gordon Message-ID: Date: Tue, 9 Oct 2018 15:43:10 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 14530 fixed close 14530 stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.52 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.52 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 14530 fixed close 14530 stop From unknown Sat Jun 21 10:46:46 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 07 Nov 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator