Skip to content
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

Unknown behaviour in src/events/SDL_mouse.c:66:26: runtime error: shift exponent -1 is negative #768

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 1.2
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2017-02-27 17:56:11 +0000, Andrei Karas wrote:

Hello,
SDL compiled with gcc 6 and asan/ubsan found this issue:

src/events/SDL_mouse.c:66:26: runtime error: shift exponent -1 is negative

This from macro SDL_BUTTON in function SDL_ResetMouse.
I think from SDL_BUTTON(0) -> 1 << -1

Negative offset is unknown behaviour. And may works or not in current and in future compilers.

This issue present in HG 1.2 and HG 2.0 and probably in other older versions.

On 2017-06-01 04:40:09 +0000, Ryan C. Gordon wrote:

SDL_ResetMouse has been disabled since before 2.0.0 shipped:

https://hg.libsdl.org/SDL/rev/36ce2e6166e7

But that code is definitely wrong in 1.2. Even before removing SDL_ResetMouse, somewhere in 1.3 someone fixed this, so I've made the same fix in 1.2 now:

https://hg.libsdl.org/SDL/rev/1138bf8c009a

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant