Missing nullptr check in implicit std::string construction in RemotedHandler::unwrap

Description

While experimenting with a replacement for XMLTooling's TemplateEngine, I ran into the following:

While rendering the session error template, if TemplateEngine->run() does not write any output to the ostream it is given, RemotedHandler::unwrap will implicitly construct a std::string from a nullptr, causing a basic_string::_S_construct NULL not valid exception to get thrown.

In the situation described above, h["data"].string() returns a nullptr, causing the implicit std::string constructor to throw an exception.

Not a huge issue since you need to go out of your way to make template rendering fail in ways that can trigger this – just a small robustness improvement. I've checked other similar (i/o)stringstream constructor sites to check for similar issues, but all others I've found have a check in place.

Environment

None

Activity

Show:

Rod Widdowson January 29, 2018 at 5:54 PM

Cherry-picked in  change

In case the project changed confused things.  Also as

this and this 

Rod Widdowson January 29, 2018 at 5:46 PM

Well that move was wrong.  Sigh

Scott Cantor November 13, 2017 at 2:08 AM

Over to Rod to apply to master.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Affects versions

Created March 11, 2017 at 7:41 PM
Updated June 24, 2021 at 2:05 PM
Resolved January 29, 2018 at 5:54 PM
Loading...