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

VideoCommon: avoid segfault when loading a PNG with no custom texture data levels #11879

Merged

Conversation

iwubcode
Copy link
Contributor

@iwubcode iwubcode commented Jun 3, 2023

This can't actually happen in our code today but it was split out of #11681

@AdmiralCurtiss
Copy link
Contributor

AdmiralCurtiss commented Jun 3, 2023

Hm, is it intentional that calling LoadPNGTexture() on a texture that already has multiple levels overwrites the first one but leaves the rest alone? Because that seems weird to me.

It might be better to refactor this from a CustomTextureData* texture parameter to a CustomTextureData::Level* level parameter and let the caller deal with selecting the proper level. that already exists, so just get rid of the CustomTextureData* texture overload and let the caller pass the level.

…ready, create a level, this avoids a potential segfault
@iwubcode iwubcode force-pushed the texture_data_load_nolevels branch from df76c00 to 47c40d5 Compare June 3, 2023 17:19
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it makes more sense like this.

@AdmiralCurtiss AdmiralCurtiss merged commit 80bf175 into dolphin-emu:master Jun 3, 2023
14 checks passed
@iwubcode iwubcode deleted the texture_data_load_nolevels branch June 3, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants