From 1f07432927838fcc09e39e8f89aad11ea2d90a76 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 16 Apr 2006 09:12:27 +0000 Subject: Fixed evil longstanding bug in String::toLowercase & toUppercase: Before modifying the string content, make sure we do not share it with any other string). This should help (hopefully fix) bug #1470892 svn-id: r21931 --- common/str.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/str.cpp b/common/str.cpp index 05be3b9e6b..47dd6eef8c 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -216,6 +216,7 @@ void String::toLowercase() { if (_str == 0 || _len == 0) return; + ensureCapacity(_len, true); for (int i = 0; i < _len; ++i) _str[i] = tolower(_str[i]); } @@ -224,6 +225,7 @@ void String::toUppercase() { if (_str == 0 || _len == 0) return; + ensureCapacity(_len, true); for (int i = 0; i < _len; ++i) _str[i] = toupper(_str[i]); } -- cgit v1.2.3