about summary refs log tree commit diff
path: root/absl/strings/internal/str_format/bind.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/strings/internal/str_format/bind.cc')
-rw-r--r--absl/strings/internal/str_format/bind.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/absl/strings/internal/str_format/bind.cc b/absl/strings/internal/str_format/bind.cc
index 758adb7a2569..a89295d5f64b 100644
--- a/absl/strings/internal/str_format/bind.cc
+++ b/absl/strings/internal/str_format/bind.cc
@@ -53,7 +53,8 @@ inline bool ArgContext::Bind(const UnboundConversion* unbound,
         // "A negative field width is taken as a '-' flag followed by a
         // positive field width."
         force_left = true;
-        width = -width;
+        // Make sure we don't overflow the width when negating it.
+        width = -std::max(width, -std::numeric_limits<int>::max());
       }
     }