[ https://issues.apache.org/jira/browse/STDCXX-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov resolved STDCXX-1060. ----------------------------------- Resolution: Fixed Fixed with adding a regression test thus: http://svn.apache.org/viewvc?view=revision&revision=1291038 > std::basic_string::append(char*, pos) SIGSEGV for pos == std::string::npos > -------------------------------------------------------------------------- > > Key: STDCXX-1060 > URL: https://issues.apache.org/jira/browse/STDCXX-1060 > Project: C++ Standard Library > Issue Type: Bug > Components: 21. Strings > Affects Versions: 4.2.1, 4.2.x, 4.3.x, 5.0.0 > Environment: Solaris 10 and 11 > Red Hat Linux, OpenSuSE Linux > Sun C++ Compiler 12.1, 12.2, 12.3 > Defect is independent of platform/compiler > Reporter: Stefan Teleman > Assignee: Farid Zaripov > Labels: conformance, segmenation_fault, standards > Fix For: 4.2.2, 4.2.x, 4.3.x, 5.0.0 > > Attachments: stdcxx-1060.patch, test.cc > > > std::basic_string::append(char*, pos) SIGSEGV for pos == std::string::npos: > {code:title=test.cc|borderStyle=solid} > #include <iostream> > #include <string> > #include <stdexcept> > int main() > { > const char* c = "hello"; > std::string s(5, '*'); > std::string t; > int ret; > try > { > t = s.append(c, std::string::npos); > } > catch (std::length_error& e) > { > ret = 0; > } > catch ( ... ) > { > std::cerr << "wrong exception was thrown!" << std::endl; > ret = 1; > } > std::cerr << "t: " << t.c_str() << std::endl; > std::cerr << "s: " << s.c_str() << std::endl; > return ret; > } > {code} > 1. Output from GCC 4.5.0: > {noformat} > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 21:56:30][2023]>> ./test-gcc > t: > s: ***** > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:04:45][2024]>> echo $status > 0 > {noformat} > 2. Output from Sun C++ 12.2 with stlport: > {noformat} > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:04:47][2025]>> ./test-ss122-stlport > t: > s: ***** > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:04:53][2026]>> echo $status > 0 > {noformat} > 3. Output from Sun C++ 12.2 with our patched stdcxx: > {noformat} > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:04:55][2027]>> ./test-ss122-stdcxx > t: > s: ***** > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:05:00][2028]>> echo $status > 0 > {noformat} > 4. Output from Pathscale 4.0.12.1 (which did not patch stdcxx): > {noformat} > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:05:02][2029]>> ./test-pathscale > Segmentation fault (core dumped) > [steleman@darthvader][/src/steleman/programming/stdcxx-ss122/bugfixes-sunw/6889785][02/05/2012 > 22:05:08][2030]>> echo $status > 139 > {noformat} > Defect is in file include/string, line 874. > Patch for stdcxx 4.2.1 to follow shortly. -- 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