Skip to content

Commit

Permalink
Core: Fix std::string init from null pointer
Browse files Browse the repository at this point in the history
Constructing a string from a null pointer is undefined behavior: it
turned out to work with gcc and MSVC, but with XCode/clang it results in
a segmentation fault. Theis fix assumes that the expected behavior is to
yield an empty string.
  • Loading branch information
chennes committed Dec 16, 2021
1 parent ab66d7b commit b1beadd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/App/ObjectIdentifier.cpp
Expand Up @@ -1678,12 +1678,16 @@ Py::Object ObjectIdentifier::access(const ResolveResults &result,
}
}
auto &propset = (*deps)[obj];
// inserting a null name in the propset indicates the dependency is
// inserting a blank name in the propset indicates the dependency is
// on all properties of the corresponding object.
if(propset.size()!=1 || propset.begin()->size()) {
if(!propName)
if (propset.size() != 1 || propset.begin()->size()) {
if (!propName) {
propset.clear();
propset.insert(propName);
propset.insert("");
}
else {
propset.insert(propName);
}
}
return;
};
Expand Down

0 comments on commit b1beadd

Please sign in to comment.