Crash in osgEarth::Annotation::PlaceNode::init due to call to __dynamic_cast with nullptr argument
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
osgearth (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Starting with gcc 6.x, some optimizations result in omission of null pointer checks in some places. This affects the osgearth package on Ubuntu 18.04, where osgEarth:
The full test case reproducing the problem:
// -------- begin -----------
#include <fstream>
#include <osgEarthAnnota
int main(int argc, char** argv)
{
const auto earthFileName=
std::ofstream earthFile(
const char data[]=
earthFile.
earthFile.
const auto earthNode = osgDB::
if(!earthNode)
{
OE_WARN << "Unable to load earth model \"" << earthFileName << "\"\n";
return EXIT_FAILURE;
}
const auto mapNode = osgEarth:
new osgEarth:
}
// --------- end --------------
Backtrace from the SIGSEGV looks like this:
#0 0x00007ffff661b35d in __dynamic_cast () from /usr/lib/
#1 0x00007ffff6cfad6f in osgEarth:
at ./src/osgEarthA
#2 0x00007ffff6cfc694 in osgEarth:
text=..., style=...) at ./src/osgEarthA
#3 0x00005555555563f7 in main (argc=1, argv=0x7fffffff
Here, if you look at the `instance` pointer variable in the frame #1, it appears equal 0x0. With this, `instance-
One easy way to "fix" this package is to use `-fno-delete-
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: libosgearthanno
ProcVersionSign
Uname: Linux 4.15.0-36-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.4
Architecture: amd64
Date: Mon Nov 19 13:32:55 2018
InstallationDate: Installed on 2015-04-22 (1307 days ago)
InstallationMedia: Kubuntu 14.04.2 LTS "Trusty Tahr" - Release amd64 (20150219.1)
SourcePackage: osgearth
UpgradeStatus: Upgraded to bionic on 2018-10-09 (40 days ago)