bug#50611: one-byte (write) heap-buffer-underrun

2021-09-15 Thread Jim Meyering
Thanks for all your recent changes! I built+tested with ASAN on Fedora 34:

Configure and build as usual, then "make clean" and do this:
> san='-fsanitize-address-use-after-scope -fsanitize=address -static-libasan'; 
> ASAN_OPTIONS=detect_leaks=0 , CFLAGS='-O -ggdb3' AM_CFLAGS="$san" 
> AM_LDFLAGS="$san" check

(but that first -f option may be obsolete, because it seems to provoke
spurious failure of the stdbuf test and help-version tests)

That exposed this (and similar in an md5sum tests):

md5sum: test ck-strict-1: stderr mismatch, comparing ck-strict-1.2
(expected) and ck-strict-1.E (actual)
*** ck-strict-1.2   Wed Sep 15 17:16:39 2021
--- ck-strict-1.E   Wed Sep 15 17:16:39 2021
***
*** 1 
! md5sum: WARNING: 1 line is improperly formatted
--- 1,47 
! =
! ==1752792==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60c0003f at pc 0x004d7387 bp 0x7fff29bac390 sp
0x7fff29bac388
! READ of size 1 at 0x60c0003f thread T0
! #0 0x4d7386 in digest_check src/digest.c:1076
! #1 0x4d7386 in main src/digest.c:1492
! #2 0x7ff1f089db74 in __libc_start_main (/lib64/libc.so.6+0x27b74)
! #3 0x40754d in _start (/home/j/w/co/cu/src/md5sum+0x40754d)
!
! 0x60c0003f is located 1 bytes to the left of 120-byte region
[0x60c00040,0x60c000b8)
! allocated by thread T0 here:
! #0 0x492417 in __interceptor_malloc
/home/j/w/co/gcc/libsanitizer/asan/asan_malloc_linux.cpp:129
! #1 0x7ff1f08ec903 in _IO_getdelim (/lib64/libc.so.6+0x76903)
! #2 0x49208f  (/home/j/w/co/cu/src/md5sum+0x49208f)
!
! SUMMARY: AddressSanitizer: heap-buffer-overflow src/digest.c:1076 in
digest_check
! Shadow bytes around the buggy address:
!   0x0c187fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
!   0x0c187fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
!   0x0c187fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
!   0x0c187fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
!   0x0c187fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
! =>0x0c187fff8000: fa fa fa fa fa fa fa[fa]00 00 00 00 00 00 00 00
!   0x0c187fff8010: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa
!   0x0c187fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
!   0x0c187fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
!   0x0c187fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
!   0x0c187fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
! Shadow byte legend (one shadow byte represents 8 application bytes):
!   Addressable:   00
!   Partially addressable: 01 02 03 04 05 06 07
!   Heap left redzone:   fa
!   Freed heap region:   fd
!   Stack left redzone:  f1
!   Stack mid redzone:   f2
!   Stack right redzone: f3
!   Stack after return:  f5
!   Stack use after scope:   f8
!   Global redzone:  f9
!   Global init order:   f6
!   Poisoned by user:f7
!   Container overflow:  fc
!   Array cookie:ac
!   Intra object redzone:bb
!   ASan internal:   fe
!   Left alloca redzone: ca
!   Right alloca redzone:cb
! ==1752792==ABORTING





bug#48894: ambiguous descriptions of logname and whoami

2021-09-15 Thread Pádraig Brady

On 07/06/2021 02:49, Christoph Anton Mitterer wrote:

Hey.

Man page of logname say:
"Print the name of the current user."

IMO that's ambiguous as it's probably ought to be the name returned by
getlogin().

So when I login as normal user, and "su -" to root, logname won't print
"root" but the normal user.
However, what most people will understand under the "the current user"
would be root, in that case.



Man AND info pages of whoami say:
"print effective userid"

However, it's the user name, that is printed, not the userid (which
most people will understand as the numerical UID).


Fixed with: 
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=f76a56831

thanks!
Pádraig





bug#49745: [PATCH] dircolors: add *direct* to TERM matching

2021-09-15 Thread Pádraig Brady

unarchive 39827
forcemerge 39827 49745
close 39287
stop

On 27/07/2021 14:29, nl6720 wrote:

* src/dircolors.hin: Add *direct* to match terminals that
support direct colors (24-bit color / TrueColor).
---
Resending this, since it seems to have been forgotten.

  src/dircolors.hin | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/dircolors.hin b/src/dircolors.hin
index 834867b14..b5d6452d7 100644
--- a/src/dircolors.hin
+++ b/src/dircolors.hin
@@ -17,6 +17,7 @@ TERM con[0-9]*x[0-9]*
  TERM cons25
  TERM console
  TERM cygwin
+TERM *direct*
  TERM dtterm
  TERM gnome
  TERM hurd



Pushed at 
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=7f303de87

cheers,
Pádraig