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 wrong types passed to XChangeProperty #1171
Conversation
|
Could you elaborate? I can't find how your new code differs from the previous one, except on big-endian systems but I doubt this is the case in #1168. |
|
|
|
tried bugfix/xlib_set_icon, crashes on XCreateImage (btw its call not affected by commit). building in steam runtime --i386 (https://github.com/ValveSoftware/steam-runtime). |
|
Wow, just tried one thing and it not crashes anymore. here we have width * height * 4 array, but [8 + i * 4 + 0]. So
fixed crash |
|
Ah, missed the dimensions at the beginning. Should this really use |
|
btw this works too. so there's simple going out of array boundaries |
|
I mean that the segfault can be caused by memory corruption after going out of boundaries and two issues caused by one problem |
|
Could you try this PR but replace |
Question is: why is there this 8 padding in the first place? Some X-related format? |
|
@MarioLiebisch in my case app crashed before any changes made in this commit. I got crash at line 789, but this commit starts at line 838. And there's obvious going out of boundaries. the array is widthheight4, but last element in the loop accessed is |
|
@mantognini I think it's copy&paste from line 841 |
|
@mantognini The offset skips the bytes used to store the image dimensions., 2 times 4 bytes. |
|
@MarioLiebisch the offset is needed only here:
but not at the converting to BGRA. |
|
The offset is no longer there that way in the new commit. Have to try that myself I guess. How do I set up the Steam Runtime? |
|
@MarioLiebisch you're looking wrong way :) offset used 2 times. This commit removed second one. https://github.com/SFML/SFML/blob/bugfix/xlib_set_icon/src/SFML/Window/Unix/WindowImplX11.cpp#L777 |
|
I'm sorry guys for lots of messages. So here's the last (i hope :) ) In the commit ca03b64 iconPixels was expanded to (width * height * 4 + 8) and assignment in the loop was offset by 8. After in commit 9996b7a iconPixels' size was decreased back to (width * height * 4), but offset was left. So the bug is here. @binary1248 thank you very much for returning to Xlib again. Yeah, that patch is huge, so it was easy to miss something |
726fa07
to
8c62390
Compare
|
Fixed. |
|
@Achpile Can you give this a try again? |
|
@eXpl0it3r i think there's no need to do it :) because I made same changes for steam release and it looks like it works fine :) |
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.
Tested on my Ubuntu VM works fine.
|
This PR has been added to my merge list, meaning it will be merged soon, unless someone raises any concerns. |
…ent data type passed to XChangeProperty to be unsigned long (architecture dependent 32-bit or 64-bit) instead of sf::Uint32 (architecture independent 32-bit) (#1168). Also adjusted other occurrences of wrong types passed to XChangeProperty with format set to 32.
8c62390
to
7fe96d1
Compare
Fixes #1168.