fix(x11): nk_stbi_image_to_xsurf corrupting memory when channels != bpl#954
Draft
sleeptightAnsiC wants to merge 1 commit intoImmediate-Mode-UI:masterfrom
Draft
fix(x11): nk_stbi_image_to_xsurf corrupting memory when channels != bpl#954sleeptightAnsiC wants to merge 1 commit intoImmediate-Mode-UI:masterfrom
sleeptightAnsiC wants to merge 1 commit intoImmediate-Mode-UI:masterfrom
Conversation
This was referenced May 5, 2026
Contributor
Author
|
Hi @riri , I'm pretty sure you're the most acknowledged with all X11/Xlib/XCB-related stuff. Mind taking a look here? Something in my guts tells me nk_stbi_image_to_xsurf is simply wrong. The things it assumes and tries to do look strange in so many ways... but I kept them all. One thing I did for testing was... $ Xephyr :2 -screen 800x600x8 &
$ DISPLAY=:2 ./bin/demo...which changed the result of |
nk_stbi_image_to_xsurf could corrupt memory when image channels did not match screen surface depth. I fixed it by checking DefaultDepth ahead of time and only then calling stbi_load* with previously calculated channels value. I had to reorganize this function a bit. TBH, I have no idea about Xlib and don't know what I'm doing, and a lot of things in nk_stbi_image_to_xsurf was already questionable, but after debugging and retesting, this makes the biggest sense to me. Fixes: Immediate-Mode-UI#950 Obsoletes: Immediate-Mode-UI#952
ce780cd to
ef4953b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #950
Obsoletes: #952
See commit message and linked issues for more info.
This might be totally wrong so turning it into the DRAFT.
cc @TomJGooding , @RobLoach