-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add missing was_loaded initialization #36440
Conversation
src/clzones.cpp:133:20: runtime error: load of value 224, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/clzones.cpp:133:20 in src/clzones.cpp:134:20: runtime error: load of value 224, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/clzones.cpp:134:20 in src/clzones.cpp:135:19: runtime error: load of value 224, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/clzones.cpp:135:19 in
src/json.cpp:438:26: runtime error: load of value 194, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/json.cpp:438:26 in
src/magic_enchantment.cpp:196:19: runtime error: load of value 224, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/magic_enchantment.cpp:196:19 in
src/item_category.cpp:30:20: runtime error: load of value 192, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/item_category.cpp:30:20 in src/item_category.cpp:31:19: runtime error: load of value 192, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/item_category.cpp:31:19 in src/item_category.cpp:32:19: runtime error: load of value 192, which is not a valid value for type 'bool' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/item_category.cpp:32:19 in
I'm surprised that neither the compilers nor clang-tidy gives any warning about these uninitialized values. |
The tests are failing. Have I messed something up? |
Nope. There are some things in json that needs to be fixed. |
We should enable UBSan on the clang test that currently uses ASan. At the time I creawted that test I didn't know it was possible to enable both together, but apparently it is. It's on my todo list, but someone else is welcome to do it. @hexagonrecursion how many UBSan errors did you see when trying this? Will it be a lot of work to fix any others? |
@jbytheway You caught me. I am indeed guilty of sitting on unreported UBSan errors. I'll report them soon (tm). |
@jbytheway I got round to reporting the ones I can still reproduce #36807 #36808 #36809. |
@jagoly And now I'm sitting on a fresh batch of unreported UBSan warnings again. Will keep reporting. |
@jbytheway I have several unreported UBSan errors with lldb stack traces that I did not report because I am unable to reliably reproduce them. Should I report them anyway? |
Are they coming from running the game or the tests? In the short term, I'd be more concerned with ones that arise in the tests, because those are the ones we need to fix to be able to turn on UBSan in the continuous integration testing. And ones you see in the tests ought to be easier to reproduce (hopefully...). |
@jbytheway they are from running the game. |
Summary
SUMMARY: Bugfixes "Fix uninitialized memory access when loading from json"
Purpose of change
To trigger the bug compile with clang UndefinedBehaviorSanitizer and start a new game. On the console you'll see