[
https://issues.apache.org/activemq/browse/AMQCPP-43?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Timothy Bish reassigned AMQCPP-43:
----------------------------------
Assignee: Timothy Bish (was: Nathan Mittler)
> Crash when getting string property that doesn't exist
> -----------------------------------------------------
>
> Key: AMQCPP-43
> URL: https://issues.apache.org/activemq/browse/AMQCPP-43
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: CMS Impl
> Affects Versions: 1.1
> Reporter: Albert Strasheim
> Assigned To: Timothy Bish
> Priority: Minor
> Fix For: 1.1
>
>
> In the case when one calls getStringProperty for a property that doesn't
> exist, a crash occurs because SimpleProperties returns NULL. I think it
> should return "".
> Test code on Linux:
> {noformat}
> #include <string>
> int main(int argc, char* argv)
> {
> std::string str(0);
> return 0;
> }
> {noformat}
> This dies with the following when run on FC6:
> {noformat}
> terminate called after throwing an instance of 'std::logic_error'
> what(): basic_string::_S_construct NULL not valid
> Aborted
> {noformat}
> Proposed patch:
> {noformat}
> ===================================================================
> --- src/main/activemq/util/SimpleProperties.h (revision 495567)
> +++ src/main/activemq/util/SimpleProperties.h (working copy)
> @@ -55,7 +55,7 @@
> std::map< std::string, std::string >::const_iterator iter =
> properties.find( name );
> if( iter == properties.end() ){
> - return NULL;
> + return "";
> }
> return iter->second.c_str();
> {noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira