From ca1560d53d2dc6a0a78ba607296b22b5ebb0feb8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 25 Oct 2009 05:39:47 -0400 Subject: Fixed overflow bug introduced by the warning fixes --- src/format.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/format.cc b/src/format.cc index 35f3d80f..ea38c861 100644 --- a/src/format.cc +++ b/src/format.cc @@ -368,8 +368,9 @@ void format_t::format(std::ostream& out_str, scope_t& scope) result = truncate(temp, elem->max_width); } else { result = temp.extract(); - for (std::size_t i = 0; i < elem->min_width - temp.length(); i++) - result += " "; + if (elem->min_width > temp.length()) + for (std::size_t i = 0; i < elem->min_width - temp.length(); i++) + result += " "; } out_str << result; } else { -- cgit v1.2.3