bug#78880: od Heap-buffer overflow

Jim Meyering <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <CA+8g5KG+TgKstO=U_pA7-8r8jpCsZZYk_ADSrsimg146QOaFnw@mail.gmail.com>
On Sun, Jun 29, 2025 at 5:18 AM Pádraig Brady <[email protected]> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.