-
Notifications
You must be signed in to change notification settings - Fork 150
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
Fix some UB in movie_lib.cc #117
Conversation
Fixes warnings shown by UBSAN during the title movie playback. Mostly misaligned loads and a couple of bad shifts.
@alexbatalov Can you please take a look at this PR? |
Thanks for pinging. Will look today. |
I've refactored your code a bit to match surroundings, hope you don't mind. |
Thanks, looks good overall, but I'm wondering what the purpose of these is: if (1) { |
@glebm @alexbatalov Why doesn't |
@alexbatalov is there any information about the |
My original constexpr auto getOffset = [](uint16_t v) {
return static_cast<int8_t>(v & 0xFF) + dword_51F018[v >> 8];
}; The refactored one is like this: uint8_t getOffset(uint16_t v)
{
return static_cast<int8_t>(v & 0xFF) + dword_51F018[v >> 8];
} The difference is the return type, that's probably why. It should probably be |
Fixes regression from alexbatalov#117, see alexbatalov#136.
…movie glitch fix This reverts commit ad8a275.
Hey, I'm pretty sure this PR caused #194 |
return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]; | ||
} | ||
|
||
uint8_t getOffset(uint16_t v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexbatalov As I mentioned in #117 (comment), the return type here (changed from auto
to uint8_t
when merging) is incorrect, it should be int
or int32_t
. This caused #136.
Fixes warnings shown by UBSAN during the title movie playback. Mostly misaligned loads and a couple of bad shifts.
This fixes the game crashing on startup on rg350m.