Closed DarkWanderer closed 3 years ago
Good find. This isn't actually my own code, but looking at it, it seems it can be fixed simply by increasing the first dimension to 12. Before I do, I'd like to see how ASAN is actually flagging this problem. I tried to run a scenario with a Dragonfly in it after building Orbiter with ASAN support, but didn't notice any warnings. Do I need to do something specific to trigger the issue? How is ASAN reporting problems it finds?
Turning this ticket into a more general one, Cppcheck finds a few more similar situations, here are some:
Some are "false positives", but others are real and should be fixed.
Cppcheck also shows situations like this "if ((extmode == CAMERA_TARGETTOOBJECT || extmode == CAMERA_TARGETTOOBJECT)" on Camera.cpp:390, which could be a typo or redundant code.
Good find. This isn't actually my own code, but looking at it, it seems it can be fixed simply by increasing the first dimension to 12. Before I do, I'd like to see how ASAN is actually flagging this problem. I tried to run a scenario with a Dragonfly in it after building Orbiter with ASAN support, but didn't notice any warnings. Do I need to do something specific to trigger the issue? How is ASAN reporting problems it finds?
I am away from my desktop where I can confirm this, but the way I stumbled into this was by launching Modules\Server\Orbiter.exe
with --scenariox=Dragonfly\Dragonfly
parameter under debugger (Visual Studio)
EDIT: this is how it looks in action. I think I might have made a mistake with ASAN confiugration currently in main
- it doesn't seem to pass the flag to compiler correctly. Will check
Please check #124. Apologies for confusion
Found an issue while running Orbiter under ASAN:
https://github.com/orbitersim/orbiter/blob/17ae0ae7c621cf5129cf14bbfd4fa0cd99187bfd/Src/Vessel/Dragonfly/instruments.cpp#L429-L432
i_names
is an arraychar[7][12]
, but is indexed from0
to11
- likely just overflows into the next array