[PATCH] elf: fix handling of negative numbers in dl-printf

Florian Weimer fweimer@redhat.com
Thu May 25 07:46:13 GMT 2023


* Roy Eldar via Libc-alpha:

> _dl_debug_vdprintf is a bare-bones printf implementation; currently
> printing a signed integer (using "%d" format specifier) behaves
> incorrectly when the number is negative, as it just prints the
> corresponding unsigned integer, preceeded by a minus sign.
>
> For example, _dl_printf("%d", -1) would print '-4294967295'.
>
> Signed-off-by: Roy Eldar <royeldar0@gmail.com>
> ---
>  elf/dl-printf.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/elf/dl-printf.c b/elf/dl-printf.c
> index e8b9900370..977ac330b6 100644
> --- a/elf/dl-printf.c
> +++ b/elf/dl-printf.c

Please update the copyright staement with

  Copyright The GNU Toolchain Authors.

Then I'm going to apply it together with the test.

Thanks,
Florian



More information about the Libc-alpha mailing list