Title: Message
It is checked the row above this row, I quote: "if (suffix.length() <= s.length()) {"

And I should be a bit more clear on anopther point to. This is my suggestion for solution, I have not commited this code, since I'm not a member of the project.
And I post it here since I'm not a member of log4cxx-dev@logging.apache.org. either. If I find more things I want to correct, I will consider to find some other way.

/BjÃrn Carlsson
VersionSupport.com

Stoyan Damov wrote:
If suffix.length() is bigger than s.length() you'll get std::out_of_range exception, because s.length() - suffix.length() will yield a *very* big value.
(but I haven't looked at the source code to see whether the arguments are being checked by the caller, so sorry for my comment, if that's the case)
Â
Cheers,
Stoyan
-----Original Message-----
From: BjÑrn Carlsson [mailto:[EMAIL PROTECTED]]
Sent: 03/09/2005 12:00
To: log4cxx-user@logging.apache.org
Subject: Corrected bug in StringHelper::endsWith on CVS HEAD

Both
ÂÂÂ bool StringHelper::endsWith(const std::string& s, const std::string& suffix)
and
ÂÂÂ bool StringHelper::endsWith(const std::wstring& s, const std::wstring& suffix)
should be like this:
ÂÂÂÂÂ return s.compare(s.length() - suffix.length(), suffix.length(), suffix) == 0;

and not
ÂÂÂÂÂ return suffix.compare(s.length() - suffix.length(), suffix.length(), s) == 0;

--
/BjÃrn Carlsson
VersionSupport.com


--

Reply via email to