images: Change stbi_load() to use 4 chans#952
Open
RobLoach wants to merge 1 commit intoImmediate-Mode-UI:masterfrom
Open
images: Change stbi_load() to use 4 chans#952RobLoach wants to merge 1 commit intoImmediate-Mode-UI:masterfrom
RobLoach wants to merge 1 commit intoImmediate-Mode-UI:masterfrom
Conversation
Contributor
|
Sorry but I really don't feel qualified to say whether this is the proper fix as mentioned in #950 (comment)! But wouldn't this only work if we presuppose the DefaultDepth is 24? I don't fully understand what the |
Contributor
|
This is more of a workaround that hides the actual bug. Not the proper fix. I haven't checked everything yet, but these two branches in nk_stbi_image_to_xsurf() are probably the root cause.
EDIT EDIT: another PR at #954 |
This was referenced May 5, 2026
sleeptightAnsiC
added a commit
to sleeptightAnsiC/Nuklear
that referenced
this pull request
May 5, 2026
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
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.
Switches the stb image loads to default to 4 channels.
Fixes #950
@TomJGooding Like this?