diffutils-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diffutils-3.7.41-7475 exercises undefined behaviour


From: Bruno Haible
Subject: Re: diffutils-3.7.41-7475 exercises undefined behaviour
Date: Wed, 28 Jul 2021 11:08:55 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

Hi Jim,

> Thanks again. Even though I never reproduced the issue, I've pushed
> the following, which should resolve it:
> 
> https://git.sv.gnu.org/cgit/diffutils.git/commit/?id=v3.7-42-g1aa7ccf

No, the patch does not fully resolve the issue. I still get

  Conditional jump or move depends on uninitialised value(s)
     at 0x402256: block_compare (cmp.c:622)
     by 0x402256: cmp (cmp.c:465)
     by 0x402256: main (cmp.c:361)

The reason is that valgrind is silent when you copy uninitialized values
to a different memory locations, and complains only when these uninitialized
values effectively have an effect. [1]

Here, the original uninitialized values are buf1[read0] and buf0[read1].

The attached patch fixes it (and does not introduce regressions in
"make check" without valgrind).

Bruno

[1] https://valgrind.org/docs/manual/mc-manual.html#mc-manual.uninitvals

Attachment: 0001-cmp-avoid-reading-uninitialized-memory.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]