-
-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running wesnoth after building with UBSan results in invalid vptr errors #2400
Comments
I rebuilt using the command shown and I cannot reproduce this crash. The game loads and I can play AToTB just fine. However, when I check the console log I see:
|
My first reaction is someone is static_cast'ing from to a non-derived class. A bit of research on SO and others a claiming it's a buffer overrun. But I think that's unlikely. Another likely culprit I'm seeing mentioned is calling a pure virtual method from the constructor; which also seems likely. |
It looks like the difference is that when I run it, it's set to exit on the first problem it hits, whereas for you it keeps going. The documentation for |
Well, considering it all has to do with GUI junk, perhaps @Vultraz needs to take a look. |
The game is running, and not crashing, without this option. So I'd say it's static_cast<> or something like that and the missing base class with at least one virtual function isn't being called. This should be fixed, but without a crash, it's not critical. |
The problem is caused by calling a virtual function in an initializer list: https://stackoverflow.com/a/25755113 |
So it looks like this is actually a fundamental flaw in the design of GUI2: every widget must define I'm not sure what's the best way to fix this. The registration procedure would work just as well if the method were non-virtual, or even just a static member variable; however, that would break any call of |
Default construct the base in the init list and call a protected function in the init body. The problem is you cannot call the virtual from the base until the unit list is done so use the protected to do it when it is safe. |
Looking more closely, I don't see why the function even needs to be virtual. It could just be non-virtual in Currently the string isn't stored in the class at all and is only used by |
Rather belated, but for:
I get a bracktrace of:
|
It also seems somewhat likely that this is related to the segfault that the boost unit tests get when LTO is enabled:
|
This also fixed the boost unit tests segafulting, FTR. |
…et_control_type Fixes wesnoth#2400. See comment in styled_widget.hpp for details.
…et_control_type Fixes wesnoth#2400. See comment in styled_widget.hpp for details. (cherry-picked from commit 52f7fcf)
…et_control_type Fixes wesnoth#2400. See comment in styled_widget.hpp for details.
…et_control_type Fixes #2400. See comment in styled_widget.hpp for details.
When building current master with Undefined Behavior Sanitizer enabled in GCC:
scons wesnoth multilib_arch=64 build=debug enable_lto=no nls=no ctool=gcc cxxtool=g++ jobs=6 --option-cache="" sanitize=undefined
Launching wesnoth-debug results in it exiting with the following error before the main menu appears:
Using GCC 5.4.0 on Mint 18.3.
The text was updated successfully, but these errors were encountered: