Pádraig Brady wrote:
> Reported at https://bugs.gnu.org/82130

How about "Reported by Lingfeng Chen at https://bugs.gnu.org/82130";, to give
the reporter a bit of credit?

> --- a/lib/strftime.c
> +++ b/lib/strftime.c
> @@ -1928,7 +1928,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
> (size_t maxsize)
>              if (digits_base >= 0x100)
>                number_digits = number_bytes / 2;
>  #endif
> -            byte_count_t shortage = width - !!sign_char - number_digits;
> +            sbyte_count_t shortage = width - !!sign_char - number_digits;
>              byte_count_t padding = (pad == NO_PAD || shortage <= 0
>                                      ? 0 : shortage);

I would change the 'padding' variable to sbyte_count_t as well.
Rationale: A few lines below, there is a statement

    width -= padding;

that is more reliable without unsigned integers.

Bruno




Reply via email to