stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (STDCXX-1063) std::string::replace (size_type, size_type, size_type, char_type) doesn't check third argument
Date Sun, 19 Feb 2012 15:54:34 GMT
std::string::replace (size_type, size_type, size_type, char_type) doesn't check third argument
----------------------------------------------------------------------------------------------

                 Key: STDCXX-1063
                 URL: https://issues.apache.org/jira/browse/STDCXX-1063
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 21. Strings
    Affects Versions: 4.2.1, 4.2.0, 4.1.4, 4.1.3
         Environment: All
            Reporter: Farid Zaripov
            Assignee: Farid Zaripov
            Priority: Minor
             Fix For: 4.2.2


The following test fails with segmentation fault:

{code}
#include <iostream>
#include <string>
#include <stdexcept>

static char long_string [4096] = {'a'};

int main ()
{
    try {
        std::string s (long_string, 4095);
        s.replace (0, 1, s.max_size () + 1, 'a');
        std::cout << "Expect length error, got nothing" << '\n';
    }
    catch (std::length_error& e) {
        std::cout << "Got expected length error" << '\n';
    }

    return 0;
}
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message