GNU bug report logs -
#78880
od Heap-buffer overflow
Previous Next
Full log
View this message in rfc822 format
On Sun, Jun 29, 2025 at 5:18 AM Pádraig Brady <P <at> draigbrady.com> 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 functions.
> > * src/od.c (enum size_spec): Arrange for enum values to
> > be the same if they represent types that behave the same.
> > (width_bytes, ISPEC_TO_FORMAT, decode_one_format):
> > Match the enum size_spec changes.
>
> The patch above causes a warning on some systems:
>
> src/od.c: In function 'decode_one_format':
> src/od.c:900:28: error: duplicated 'if' condition [-Werror=duplicated-cond]
> 900 | else if (size_spec == FLOAT_HALF)
> | ~~~~~~~~~~^~~~~~~~~~~~~
> src/od.c:895:28: note: previously used here
> 895 | else if (size_spec == FLOAT_SINGLE)
> | ~~~~~~~~~~^~~~~~~~~~~~~~~
>
> If we want the compiler to just apply Dead Code Elimination here,
> then it may be best to push/pop ignoring that warning ?
Thanks. I agree.
This bug report was last modified 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.