[all-commits] [llvm/llvm-project] a21fc4: [libc] Fix printf handling of INT_MIN width (#101729)

Michael Jones via All-commits all-commits at lists.llvm.org
Fri Aug 2 13:46:15 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a21fc4c0a681000c23089301e8935f579517b96a
      https://github.com/llvm/llvm-project/commit/a21fc4c0a681000c23089301e8935f579517b96a
  Author: Michael Jones <michaelrj at google.com>
  Date:   2024-08-02 (Fri, 02 Aug 2024)

  Changed paths:
    M libc/docs/dev/printf_behavior.rst
    M libc/src/stdio/printf_core/parser.h
    M libc/test/src/stdio/printf_core/parser_test.cpp
    M libc/test/src/stdio/snprintf_test.cpp

  Log Message:
  -----------
  [libc] Fix printf handling of INT_MIN width (#101729)

Prevously, if INT_MIN was passed as a wildcard width to a printf
conversion the parser would attempt to negate it to get the positive
width (and set the left justify flag), but it would underflow and the
width would be treated as 0. This patch corrects the issue by instead
treating a width of INT_MIN as identical to -INT_MAX.

Also includes docs changes to explain this behavior and adding b to the
list of int conversions.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list