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

integer passed to XChangeProperty() causes crash #666

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

integer passed to XChangeProperty() causes crash #666

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 1.2.15
Reported for operating system, platform: NetBSD, Other

Comments on the original bug report:

On 2012-02-20 06:51:12 +0000, Julian Coleman wrote:

Created attachment 825
Fix for XChangeProperty crash.

In src/video/x11/SDL_x11video.c, the result of getpid(), i.e., a pid_t is passed to:

XChangeProperty(..., 32, ...)

However, using 32 here means that Xlib treats the value as a long, and pid_t is an int. So, we get a bus error inside Xlib.
The fix is to make sure that anything passed to XChangeProperty() is aligned correctly. Note, that the other calls to XChangeProperty() pass long values here.
The proposed patch makes a union of the pid_t return type from getpid() and a dummy long. This has been tested to fix the bus error crash on NetBSD/sparc64.

On 2012-02-20 17:51:45 +0000, Sam Lantinga wrote:

Fixed, thanks!
http://hg.libsdl.org/SDL/rev/57a55e457ef6

Can you take a look at the SDL 2.0 code and see if a similar fix is necessary there?
http://www.libsdl.org/tmp/SDL-2.0.tar.gz

On 2012-02-21 03:18:35 +0000, Julian Coleman wrote:

Hi,

Looking at src/video/x11/SDL_x11window.c in SDLK 2.0.0, XChangeProperty() is passed &data->pid. data is a struct SDL_VideoData, and pid is a pid_t in the struct. So, this looks like it will have the same problem as 1.2.15. The same fix should apply, but inside the definition of struct SDL_VideoData.

Thanks,

J

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