diffutils-devel
[Top][All Lists]
Advanced

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

diffutils-3.7.41-7475 exercises undefined behaviour


From: Bruno Haible
Subject: diffutils-3.7.41-7475 exercises undefined behaviour
Date: Sun, 25 Jul 2021 05:36:31 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

Hi,

Using uninitialized storage is undefined behavior in C. [1] But 'cmp' does this.

How to reproduce:
0. Install valgrind and the attached 'valgrind-wrap' script.
1. Build diffutils:
     ./configure ...
     make
2. valgrind-wrap src/cmp src/diff src/diff3 src/sdiff
3. make check

The result is that this valgrind 'error' appears a couple of times:

  Conditional jump or move depends on uninitialised value(s)
     at 0x4020F0: block_compare (cmp.c:620)
     by 0x4020F0: cmp (cmp.c:463)
     by 0x4020F0: main (cmp.c:361)

Would it be possible to run block_compare on an initialized buffer,
instead of on a partially uninitialized one?

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2021-07/msg00047.html

Attachment: valgrind-wrap
Description: application/shellscript


reply via email to

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