lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYi22HORrZgSCS0u@1wt.eu>
Date: Sun, 8 Feb 2026 17:16:24 +0100
From: Willy Tarreau <w@....eu>
To: david.laight.linux@...il.com
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
        linux-kernel@...r.kernel.org, Cheng Li <lechain@...il.com>
Subject: Re: [PATCH v2 next 08/11] tools/nolibc/printf: Add support for zero
 padding and field precision

On Fri, Feb 06, 2026 at 07:11:18PM +0000, david.laight.linux@...il.com wrote:
> +				/* Add zero padding */
> +				if (_NOLIBC_PF_FLAGS_CONTAIN(flags, '0', '.')) {
> +					if (!_NOLIBC_PF_FLAGS_CONTAIN(flags, '.')) {
> +						if (_NOLIBC_PF_FLAGS_CONTAIN(flags, '-'))
> +							/* Left justify overrides zero pad */
> +							goto prepend_sign;
> +						/* eg "%05d", Zero pad to field width less sign */
> +						precision = width;
> +						if (sign) {
> +							precision--;
> +							if (sign >= 256)

This is the one that confused me with previous patch. As long as we cannot
have 4 chars that's OK, otherwise the 4th char can flip the sign. We could
also add and unsigned cast here to clarify this, though admittedly this
should not change over time.

Just for the record, this is the patch that increases the code the most
(+265 bytes for me, no jump tables). But I think the feature is worth it
and I'm not seeing low hanging fruits to reduce it. I honestly find the
code particularly complex to follow now but that's related to the
multiplicity of output formats and I doubt we can do much about this.

Acked-by: Willy Tarreau <w@....eu>

Willy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ