[PATCH] Tighten length error check in string::replace

Paolo Carlini pcarlini@unitus.it
Thu Apr 25 16:39:00 GMT 2002


Paolo Carlini wrote:

> Thinking more about this, I'm finding this bug pretty serious and 
> would even ask for having the patch in 3.1.0, if still possible.

This is a testcase which currently /wrongly/ throws (aborts), and should 
not (it doesn't with the patch applied):

#include <string>

int main()
{
  std::string aa = "londinium";
  std::string bb = "cydonia";

  aa.replace(0, 20, bb.c_str(), 3);
}

Paolo.

 



More information about the Libstdc++ mailing list