bug#78880: od Heap-buffer overflow

2025-06-30 Thread Pádraig Brady
On 30/06/2025 01:25, Paul Eggert wrote: On 2025-06-29 12:59, Pádraig Brady wrote: I've manually suppressed that error instance in our coverity instance. Maybe the change I just installed removed the need for that manual suppression? Indeed it does. I checked with ./configure utils_cv_ieee_16

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Paul Eggert
As sometimes happens (in my case, while walking the dog) I thought of one or two more little problems in that area, and installed the attached patches to fix them. The first patch merely refactors; the second one does the fix; the third one adds test cases.From 617220e970f267fbeea80d5cd8b62aec2b

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Paul Eggert
On 2025-06-29 12:59, Pádraig Brady wrote: I've manually suppressed that error instance in our coverity instance. Maybe the change I just installed removed the need for that manual suppression?

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Paul Eggert
On 2025-06-29 05:17, Pádraig Brady wrote: If we want the compiler to just apply Dead Code Elimination here, then it may be best to push/pop ignoring that warning ? Or, since GCC didn't complain about similar code elsewhere, we can change the complained-about code to look more like the code els

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Pádraig Brady
On 29/06/2025 13:17, Pádraig Brady wrote: On 29/06/2025 05:25, Paul Eggert wrote: > od: omit some duplicate code > On x86-64 (for example) print_long, print_long_long, and > print_intmax all behave identically, so give GCC enough info so > that it generates code for just one of these fun

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Jim Meyering
On Sun, Jun 29, 2025 at 5:18 AM Pádraig Brady wrote: > On 29/06/2025 05:25, Paul Eggert wrote: > > > od: omit some duplicate code > > On x86-64 (for example) print_long, print_long_long, and > > print_intmax all behave identically, so give GCC enough info so > > that it generates code for just

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Jim Meyering
On Sat, Jun 28, 2025 at 9:25 PM Paul Eggert wrote: > On 2025-06-24 18:31, Jim Meyering wrote: > > That goes way back. I think od.c > > was the second stand-alone program I contributed to coreutils (first > > was tr). The earliest email I still have that mentions it is from > > 1997-01 prior to tex

bug#78880: od Heap-buffer overflow

2025-06-29 Thread Pádraig Brady
On 29/06/2025 05:25, Paul Eggert wrote: > od: omit some duplicate code > On x86-64 (for example) print_long, print_long_long, and > print_intmax all behave identically, so give GCC enough info so > that it generates code for just one of these functions. > * src/od.c (enum size_spec): Arrange for

bug#78880: od Heap-buffer overflow

2025-06-28 Thread Collin Funk
Hi Paul, Paul Eggert writes: > * src/od.c (width_bytes, decode_one_format): Don’t assume a signed > type has the same size as the corresponding unsigned type. > This has no effect on practical platforms; it’s just for > consistency there. > --- > src/od.c | 18 +- > 1 file chang

bug#78880: od Heap-buffer overflow

2025-06-28 Thread Paul Eggert
On 2025-06-24 18:31, Jim Meyering wrote: That goes way back. I think od.c was the second stand-alone program I contributed to coreutils (first was tr). The earliest email I still have that mentions it is from 1997-01 prior to textutils-1.22, but that was just a ChangeLog entry about adapting to a

bug#78880: od Heap-buffer overflow

2025-06-27 Thread Collin Funk
Hi Grisha, Grisha Levit writes: >> Grisha, what did you pass to ./configure? >> >> I'm suprised we don't disable this in Gnulib. Since there we do: >> >> static_assert (1 < sizeof (example)) >> >> Without a second argument message string, I would expect Clang to >> complain about it, unless

bug#78880: od Heap-buffer overflow

2025-06-27 Thread Grisha Levit
On Tue, Jun 24, 2025, 12:34 Collin Funk wrote: > > Pádraig Brady writes: > > > On 24/06/2025 15:27, Grisha Levit wrote: > > > >> This part: > >> > >>> tryline: > >>> + idx_t i = 0; > >>> + int c = 1; /* Init to 1 so can distinguish if NUL read. */ > >> triggers > >> w

bug#78880: od Heap-buffer overflow

2025-06-25 Thread Collin Funk
Pádraig Brady writes: > On 24/06/2025 15:27, Grisha Levit wrote: > >> This part: >> >>> tryline: >>> + idx_t i = 0; >>> + int c = 1; /* Init to 1 so can distinguish if NUL read. */ >> triggers >> warning: label followed by a declaration is a C23 extension >> [-Wc23-e

bug#78880: od Heap-buffer overflow

2025-06-24 Thread Jim Meyering
On Tue, Jun 24, 2025 at 8:29 AM Pádraig Brady wrote: > OK version 3 attached which simplifies > by removing the label and gotos entirely. Thanks for fixing my very old bugs! That goes way back. I think od.c was the second stand-alone program I contributed to coreutils (first was tr). The earliest

bug#78880: od Heap-buffer overflow

2025-06-24 Thread Pádraig Brady
On 24/06/2025 15:27, Grisha Levit wrote: This part: tryline: + idx_t i = 0; + int c = 1; /* Init to 1 so can distinguish if NUL read. */ triggers warning: label followed by a declaration is a C23 extension [-Wc23-extensions] OK version 3 attached which simplif

bug#78880: od Heap-buffer overflow

2025-06-24 Thread Grisha Levit
On Tue, Jun 24, 2025, 10:04 Pádraig Brady wrote: > > On 24/06/2025 01:16, Pádraig Brady wrote: > > On 23/06/2025 09:24, Jaehoon Jang wrote: > >> = > >> ==1151699==ERROR: AddressSanitizer: heap-buffer-overflow on address > >> 0x615

bug#78880: od Heap-buffer overflow

2025-06-24 Thread Pádraig Brady
On 24/06/2025 01:16, Pádraig Brady wrote: On 23/06/2025 09:24, Jaehoon Jang wrote: = ==1151699==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x615004f9 at pc 0x004d153f bp 0x7fff937f0410 sp 0x7fff937f0408 WRITE o

bug#78880: od Heap-buffer overflow

2025-06-23 Thread Pádraig Brady
On 23/06/2025 09:24, Jaehoon Jang wrote: = ==1151699==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x615004f9 at pc 0x004d153f bp 0x7fff937f0410 sp 0x7fff937f0408 WRITE of size 1 at 0x615004f9 thread T0 #