From unknown Wed Jun 18 23:14:51 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#50611 <50611@debbugs.gnu.org> To: bug#50611 <50611@debbugs.gnu.org> Subject: Status: one-byte (write) heap-buffer-underrun Reply-To: bug#50611 <50611@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:14:51 +0000 retitle 50611 one-byte (write) heap-buffer-underrun reassign 50611 coreutils submitter 50611 Jim Meyering severity 50611 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 15 20:29:19 2021 Received: (at submit) by debbugs.gnu.org; 16 Sep 2021 00:29:19 +0000 Received: from localhost ([127.0.0.1]:53481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQfHD-00076g-Dq for submit@debbugs.gnu.org; Wed, 15 Sep 2021 20:29:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:56254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQfHB-00076Y-FO for submit@debbugs.gnu.org; Wed, 15 Sep 2021 20:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQfHB-0001Th-9q for bug-coreutils@gnu.org; Wed, 15 Sep 2021 20:29:17 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:35592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQfH9-0004d9-At for bug-coreutils@gnu.org; Wed, 15 Sep 2021 20:29:16 -0400 Received: by mail-wm1-f43.google.com with SMTP id z184-20020a1c7ec1000000b003065f0bc631so6124099wmc.0 for ; Wed, 15 Sep 2021 17:29:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ngEm46QCVSgGG4OSEGd5HDS9FUcL9usOHT53RIvPxf4=; b=hEZHJ7HshFJuYy3VBWW2m/wQJe4uGkAFTZPa0o+4IIsCGGqn2bv3/PKBqU2mvmhcPZ Ei3x+ZPmn6KifPjcCeKvOg6EjR67iTMR1AR850J8hzE3v7fkdpyOgdv9liZaQpkPI7I2 GV4h74THF9jADSr3SJU1KWbi8/rvVQzDHZqZ5/z0VoYQtK4AoQZ99OdOLbw/6ZIA4kw3 rH9lRzExnnkMsfL/Bw+/ZjQaefGR/7Q/CQSTWDHvJvTCsqLa/XW83QVlJD6PCl8Yf3vS l6ba8IgOsHZah+kSWmOZGDj3p4Gzr9sqboqKA84Ijdaf0Pf94cC1sxTKvsVuplf9ccyk rs/w== X-Gm-Message-State: AOAM533hvO4p8u9NHL95T7WeSEDxhvUnndzHf7Q7pgY+IS9SDiS/e5yF mhYMhaMl3eC3sJETh5YZhSuEzPX94SGV/GQHz+m0s7jHuM/DGXxR X-Google-Smtp-Source: ABdhPJymsfqd+OEj3zCLOEiGN/HbUJ6sWAV49LS5lmUT6KUYWj3/zsvmmJ4BqxlBOpyUbe4dg5Pw98tsY4xIgtkhQ/M= X-Received: by 2002:a05:600c:ac5:: with SMTP id c5mr2314295wmr.191.1631752152065; Wed, 15 Sep 2021 17:29:12 -0700 (PDT) MIME-Version: 1.0 From: Jim Meyering Date: Wed, 15 Sep 2021 17:29:00 -0700 Message-ID: Subject: one-byte (write) heap-buffer-underrun To: bug-coreutils@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=209.85.128.43; envelope-from=meyering@gmail.com; helo=mail-wm1-f43.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.8 (/) X-Debbugs-Envelope-To: submit 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.8 (-) Thanks for all your recent changes! I built+tested with ASAN on Fedora 34: Configure and build as usual, then "make clean" and do this: > san='-fsanitize-address-use-after-scope -fsanitize=address -static-libasan'; ASAN_OPTIONS=detect_leaks=0 , CFLAGS='-O -ggdb3' AM_CFLAGS="$san" AM_LDFLAGS="$san" check (but that first -f option may be obsolete, because it seems to provoke spurious failure of the stdbuf test and help-version tests) That exposed this (and similar in an md5sum tests): md5sum: test ck-strict-1: stderr mismatch, comparing ck-strict-1.2 (expected) and ck-strict-1.E (actual) *** ck-strict-1.2 Wed Sep 15 17:16:39 2021 --- ck-strict-1.E Wed Sep 15 17:16:39 2021 *************** *** 1 **** ! md5sum: WARNING: 1 line is improperly formatted --- 1,47 ---- ! ================================================================= ! ==1752792==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c00000003f at pc 0x0000004d7387 bp 0x7fff29bac390 sp 0x7fff29bac388 ! READ of size 1 at 0x60c00000003f thread T0 ! #0 0x4d7386 in digest_check src/digest.c:1076 ! #1 0x4d7386 in main src/digest.c:1492 ! #2 0x7ff1f089db74 in __libc_start_main (/lib64/libc.so.6+0x27b74) ! #3 0x40754d in _start (/home/j/w/co/cu/src/md5sum+0x40754d) ! ! 0x60c00000003f is located 1 bytes to the left of 120-byte region [0x60c000000040,0x60c0000000b8) ! allocated by thread T0 here: ! #0 0x492417 in __interceptor_malloc /home/j/w/co/gcc/libsanitizer/asan/asan_malloc_linux.cpp:129 ! #1 0x7ff1f08ec903 in _IO_getdelim (/lib64/libc.so.6+0x76903) ! #2 0x49208f (/home/j/w/co/cu/src/md5sum+0x49208f) ! ! SUMMARY: AddressSanitizer: heap-buffer-overflow src/digest.c:1076 in digest_check ! Shadow bytes around the buggy address: ! 0x0c187fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ! 0x0c187fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ! 0x0c187fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ! 0x0c187fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ! 0x0c187fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ! =>0x0c187fff8000: fa fa fa fa fa fa fa[fa]00 00 00 00 00 00 00 00 ! 0x0c187fff8010: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa ! 0x0c187fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa ! 0x0c187fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa ! 0x0c187fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa ! 0x0c187fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa ! Shadow byte legend (one shadow byte represents 8 application bytes): ! Addressable: 00 ! Partially addressable: 01 02 03 04 05 06 07 ! Heap left redzone: fa ! Freed heap region: fd ! Stack left redzone: f1 ! Stack mid redzone: f2 ! Stack right redzone: f3 ! Stack after return: f5 ! Stack use after scope: f8 ! Global redzone: f9 ! Global init order: f6 ! Poisoned by user: f7 ! Container overflow: fc ! Array cookie: ac ! Intra object redzone: bb ! ASan internal: fe ! Left alloca redzone: ca ! Right alloca redzone: cb ! ==1752792==ABORTING From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 03:26:45 2021 Received: (at 50611-done) by debbugs.gnu.org; 16 Sep 2021 07:26:45 +0000 Received: from localhost ([127.0.0.1]:53670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQlnA-0000Ur-Q6 for submit@debbugs.gnu.org; Thu, 16 Sep 2021 03:26:45 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQln8-0000Ud-Au for 50611-done@debbugs.gnu.org; Thu, 16 Sep 2021 03:26:44 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DA7CC160108; Thu, 16 Sep 2021 00:26:35 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id aa55EvgYLjtJ; Thu, 16 Sep 2021 00:26:35 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2477C160165; Thu, 16 Sep 2021 00:26:35 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FQjRalpxmCmV; Thu, 16 Sep 2021 00:26:35 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id F0B7E160108; Thu, 16 Sep 2021 00:26:34 -0700 (PDT) Subject: Re: bug#50611: one-byte (write) heap-buffer-underrun To: Jim Meyering References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Thu, 16 Sep 2021 00:26:34 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------709B801536AA6AAC6A3352C1" Content-Language: en-US X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 50611-done Cc: 50611-done@debbugs.gnu.org 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: -3.4 (---) This is a multi-part message in MIME format. --------------709B801536AA6AAC6A3352C1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for reporting that. I installed the attached to fix it. --------------709B801536AA6AAC6A3352C1 Content-Type: text/x-patch; charset=UTF-8; name="0001-cksum-fix-off-by-1-bug-with-r-stripping.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-cksum-fix-off-by-1-bug-with-r-stripping.patch" >From 121f74dfc2e060a2ae174a636cd773f4d461a852 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 16 Sep 2021 00:17:18 -0700 Subject: [PATCH] cksum: fix off-by-1 bug with \r stripping Problem reported by Jim Meyering (Bug#50611). * src/digest.c (digest_check): When stripping trailing \r, avoid subscript error before start of line. --- src/digest.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/digest.c b/src/digest.c index 0d7ce3265..fdf01b21b 100644 --- a/src/digest.c +++ b/src/digest.c @@ -1070,11 +1070,10 @@ digest_check (char const *checkfile_name) continue; /* Remove any trailing newline. */ - if (line[line_length - 1] == '\n') - line[--line_length] = '\0'; + line_length -= line[line_length - 1] == '\n'; /* Remove any trailing carriage return. */ - if (line[line_length - 1] == '\r') - line[--line_length] = '\0'; + line_length -= line[line_length - (0 < line_length)] == '\r'; + line[line_length] = '\0'; if (! (split_3 (line, line_length, &hex_digest, &binary, &filename) && ! (is_stdin && STREQ (filename, "-")))) -- 2.30.2 --------------709B801536AA6AAC6A3352C1-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 07:34:31 2021 Received: (at 50611) by debbugs.gnu.org; 16 Sep 2021 11:34:31 +0000 Received: from localhost ([127.0.0.1]:53969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQpew-0006xM-Qn for submit@debbugs.gnu.org; Thu, 16 Sep 2021 07:34:31 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:50900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQper-0006x2-O7 for 50611@debbugs.gnu.org; Thu, 16 Sep 2021 07:34:30 -0400 Received: by mail-wm1-f52.google.com with SMTP id 140so4599174wma.0 for <50611@debbugs.gnu.org>; Thu, 16 Sep 2021 04:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=74eiLEEpRf7iKIAxaMAoj5K97lNTIQQkT40K98Aqu1c=; b=AC+eo7YGKM32m5ycuwxCJAUaCx8zhzOEcAyTCZ4eJSzua/AKQ0608v6WZBp7lwwIsc kUnoVmTuDh1HcdZmnyLm54TrDjba5B6Dv22t3ftWOHklLren0mI9NC++m/LkYC7msLVx wSols5nC4CN7pXxus9n1Vp3hsaclQbfTbHPE2foHUlh9zuCDzEkvlvWOUcKOJ7wK8AO8 E4K65jv5D66yEG5pdT2lZfPDcxaMpKL/PtGjIIeatUkCxX6PEg+ZLS/q0jPR8V2lUjVD XR8HusIT4cTnQGpAztwpSMulgb+yEV9WUxqkie3a1Pzug1nEF/GgBO+JH5JQQYYt7JUT 1jeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=74eiLEEpRf7iKIAxaMAoj5K97lNTIQQkT40K98Aqu1c=; b=2H/jm2IyxTPMIICZYzrOOLUgnHVzbiCGuZS9+GFhB102wAQGzpDnFfT6QsliGBsGOn Qj9UUuj9L4ENzp7pOfEiGpDeccejBoncS8QnlwwlJwMI77vnKOxzt9Z8SyRHofTjIV/z zDNk1zGAxwCVbQBT1OTDhBz3qpnP7mP40+At7ZVqCpoTyROCvgb1dtFFHJi79h3HF+w9 1ueySAriFEbdcM6No/B35uOX245OVchhcKFKbi4IZI3z1clRFVbgGxn4NYJ1h5B5+IYJ 21I4yb2Gw+/tUrGbj6qP3vMSB1JYAEFMCqpfJS8jUSKSbGXHD6PLaYvFRsq23JlbErxd XoQg== X-Gm-Message-State: AOAM531Yy2j3PCF+uauQ6QZPL78+n8if/HrIPX1RqEak57ijBSI/CU7M CIdPjhJj/iKnUZs4W1n/RaI= X-Google-Smtp-Source: ABdhPJxB6N7qYTBlCKGvAkYoBQDxf3AUfxi5o7JIz2Hf0BDTec0AdGcULvcMpmCtjqwYSIUbQJSE6g== X-Received: by 2002:a1c:7e8a:: with SMTP id z132mr4480928wmc.75.1631792059707; Thu, 16 Sep 2021 04:34:19 -0700 (PDT) Received: from localhost.localdomain (86-42-15-3-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.15.3]) by smtp.googlemail.com with UTF8SMTPSA id a6sm7247606wmb.7.2021.09.16.04.34.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 04:34:19 -0700 (PDT) Subject: Re: bug#50611: one-byte (write) heap-buffer-underrun To: 50611@debbugs.gnu.org, eggert@cs.ucla.edu, jim@meyering.net References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <70ebdc6f-f5fe-8bd1-60ea-cdc10f9d3cf0@draigBrady.com> Date: Thu, 16 Sep 2021 12:34:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------52988F8EE9EE998A987E8B96" Content-Language: en-US X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50611 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: -0.6 (/) This is a multi-part message in MIME format. --------------52988F8EE9EE998A987E8B96 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 16/09/2021 08:26, Paul Eggert wrote: > Thanks for reporting that. I installed the attached to fix it. Thanks to you both. The fix looks good. It got me thinking though, that we should not we warning/failing on blank lines. I.e., we should be treating blank lines like comments. The attached does that. cheers, Pádraig --------------52988F8EE9EE998A987E8B96 Content-Type: text/x-patch; charset=UTF-8; name="digest-blank-lines.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="digest-blank-lines.patch" >From 110556356911f1f2e0274eda803f8018f543266d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 16 Sep 2021 12:29:12 +0100 Subject: [PATCH] digest: ignore empty lines when checking * src/digest.c (digest_check): Treat blank lines like comments, as commented checksum files very often have blank lines. * tests/misc/md5sum.pl: Adjust accordingly. --- src/digest.c | 4 ++++ tests/misc/md5sum.pl | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/digest.c b/src/digest.c index 9ee37a104..d13a05a3a 100644 --- a/src/digest.c +++ b/src/digest.c @@ -1075,6 +1075,10 @@ digest_check (char const *checkfile_name) line_length -= line[line_length - (0 < line_length)] == '\r'; line[line_length] = '\0'; + /* Ignore blank lines. */ + if (line_length == 0) + continue; + if (! (split_3 (line, line_length, &hex_digest, &binary, &filename) && ! (is_stdin && STREQ (filename, "-")))) { diff --git a/tests/misc/md5sum.pl b/tests/misc/md5sum.pl index 09c2174f5..9b18219ac 100755 --- a/tests/misc/md5sum.pl +++ b/tests/misc/md5sum.pl @@ -53,18 +53,15 @@ my @Tests = {IN=> {'f.md5' => "$degenerate f\r\n"}}, {OUT=>"f: OK\n"}], - # Same as above, but with an added empty line, to provoke --strict. + # Same as above, but with an added empty line, to test --strict. ['ck-strict-1', '--check --strict', {AUX=> {f=> ''}}, {IN=> {'f.md5' => "$degenerate f\n\n"}}, - {OUT=>"f: OK\n"}, - {ERR=>"md5sum: " - . "WARNING: 1 line is improperly formatted\n"}, - {EXIT=> 1}], + {OUT=>"f: OK\n"}], # As above, but with the invalid line first, to ensure that following # lines are processed in spite of the preceding invalid input line. ['ck-strict-2', '--check --strict', {AUX=> {f=> ''}}, - {IN=> {'in.md5' => "\n$degenerate f\n"}}, + {IN=> {'in.md5' => "invalid\n$degenerate f\n"}}, {OUT=>"f: OK\n"}, {ERR=>"md5sum: " . "WARNING: 1 line is improperly formatted\n"}, -- 2.26.2 --------------52988F8EE9EE998A987E8B96-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 14:51:12 2021 Received: (at 50611) by debbugs.gnu.org; 16 Sep 2021 18:51:12 +0000 Received: from localhost ([127.0.0.1]:56558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQwTY-0003JE-93 for submit@debbugs.gnu.org; Thu, 16 Sep 2021 14:51:12 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQwTV-0003Is-QD for 50611@debbugs.gnu.org; Thu, 16 Sep 2021 14:51:11 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7E760160179; Thu, 16 Sep 2021 11:51:03 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 9-ntiLQF3LZk; Thu, 16 Sep 2021 11:51:02 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B297416017A; Thu, 16 Sep 2021 11:51:02 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yahOR6Y1dkI4; Thu, 16 Sep 2021 11:51:02 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8C66D160179; Thu, 16 Sep 2021 11:51:02 -0700 (PDT) Subject: Re: bug#50611: one-byte (write) heap-buffer-underrun To: =?UTF-8?Q?P=c3=a1draig_Brady?= , 50611@debbugs.gnu.org, jim@meyering.net References: <70ebdc6f-f5fe-8bd1-60ea-cdc10f9d3cf0@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <439e8f3e-db64-4449-2d85-bff9db7ffb1a@cs.ucla.edu> Date: Thu, 16 Sep 2021 11:51:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <70ebdc6f-f5fe-8bd1-60ea-cdc10f9d3cf0@draigBrady.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 50611 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: -3.4 (---) On 9/16/21 4:34 AM, P=C3=A1draig Brady wrote: > It got me thinking though, that we should not we warning/failing on=20 > blank lines. > I.e., we should be treating blank lines like comments. > The attached does that. Thaks, a good improvement. The nerd in me also suggests changing this: line[line_length] =3D '\0'; /* Ignore blank lines. */ if (line_length =3D=3D 0) continue; to this: /* Ignore empty lines. */ if (line_length =3D=3D 0) continue; line[line_length] =3D '\0'; From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 16 15:43:12 2021 Received: (at 50611) by debbugs.gnu.org; 16 Sep 2021 19:43:12 +0000 Received: from localhost ([127.0.0.1]:56617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxHs-0004xU-1Z for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:43:12 -0400 Received: from mail-wm1-f41.google.com ([209.85.128.41]:39496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxHo-0004xB-Rj for 50611@debbugs.gnu.org; Thu, 16 Sep 2021 15:43:10 -0400 Received: by mail-wm1-f41.google.com with SMTP id 196-20020a1c04cd000000b002fa489ffe1fso8191120wme.4 for <50611@debbugs.gnu.org>; Thu, 16 Sep 2021 12:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CuBQbn2oKvN88KzpfFO3pVj3EXbS4nH18VRCxLHs2dM=; b=ZZtrR8WPRrLyjo0QXcs2eW5IxhdiKhsCEhOotAxw/Zf7vEFH6Te/xmBEQYfUpdBM3S oP1T05EiO9gc2jjDAdkDpI+DcxUWWquq32en5Yahz3AMepqOmRMDgmAX5k2DbaBY1wa4 JchN2cyYqyfW2NPKMx+eTJpAa72RnmFKlz7lPPt22UvlaPOPzaFSu1vM0t0covy0bLlQ RnbHSnCtlN0TKY4aTYw7u85CXScTGk6+9jxWeP2rNwOEV3S0R0VjH5a9yqUTFmRm/oJK p7UJnPBkxqG3nlzjb6GQUHRoTc/ndyolQQAGBgMmZz9BbQte9NnUsuWyUZWbuGbv0n3n P0ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CuBQbn2oKvN88KzpfFO3pVj3EXbS4nH18VRCxLHs2dM=; b=gKDktelxm/MswIACCn/lyoa59fe1KsRG8UCvA5aiRjLJcJ9OKjkSwhoUrax0wcXwGx tdvBvvhdGbPOekolMVwdONNET6IHapdhAQhUHYMUDEgZKlYgFZEIuh/iQPUyY7qy0GBk RB4KA6MGUU7dZdKN/PmJPmYolRfR5/Kv3feshpqXPIc6oHTbDmsKCETP1vU1JPdUNKeC GYm0xsDcHDpFskgLghyAiNVtlOP9ondgPFEO2BhsL/pzii0Hn7UPuWv1PeNiBuXqHPi5 5KcETs6acF8fN/y+6LB8spPkFumQvpcYfeDmLa/TRCxewRkCJ2SVONfwJzLWdxe039vk 4pYg== X-Gm-Message-State: AOAM531NIkvr37RFM8bQso+LXEF/djo3Ui2GYGA2Hv4T8jSFh3ytJC/g SCkO1jI8G5+F7VsEyaAiVaavQkZOsfENJg== X-Google-Smtp-Source: ABdhPJwnROuNkr8dyMQ5rGyrCCrwD8LTs2lweA3tnt6UPQtOPsqZ82XxuLISff5oS5/StNUlriShXQ== X-Received: by 2002:a7b:c0c5:: with SMTP id s5mr11855684wmh.126.1631821382419; Thu, 16 Sep 2021 12:43:02 -0700 (PDT) Received: from localhost.localdomain (86-44-211-219-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.219]) by smtp.googlemail.com with UTF8SMTPSA id g1sm9812773wmk.2.2021.09.16.12.43.01 for <50611@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 12:43:01 -0700 (PDT) Subject: Re: bug#50611: one-byte (write) heap-buffer-underrun To: 50611@debbugs.gnu.org References: <70ebdc6f-f5fe-8bd1-60ea-cdc10f9d3cf0@draigBrady.com> <439e8f3e-db64-4449-2d85-bff9db7ffb1a@cs.ucla.edu> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <3821ec88-5a99-60a7-f281-0d3e648bac1c@draigBrady.com> Date: Thu, 16 Sep 2021 20:43:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: <439e8f3e-db64-4449-2d85-bff9db7ffb1a@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 50611 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: -0.6 (/) On 16/09/2021 19:51, Paul Eggert wrote: > On 9/16/21 4:34 AM, Pádraig Brady wrote: >> It got me thinking though, that we should not we warning/failing on >> blank lines. >> I.e., we should be treating blank lines like comments. >> The attached does that. > > Thaks, a good improvement. The nerd in me also suggests changing this: > > line[line_length] = '\0'; > > /* Ignore blank lines. */ > if (line_length == 0) > continue; > > to this: > > /* Ignore empty lines. */ > if (line_length == 0) > continue; > > line[line_length] = '\0'; Pushed with that adjustment. cheers, Pádraig From unknown Wed Jun 18 23:14:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 15 Oct 2021 11: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