Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Yutani: checking icon for NULL too late #276

Open
mxlgv opened this issue Apr 17, 2023 · 5 comments
Open

Yutani: checking icon for NULL too late #276

mxlgv opened this issue Apr 17, 2023 · 5 comments

Comments

@mxlgv
Copy link

mxlgv commented Apr 17, 2023

Yutani doesn't check icon for NULL, probably causing applications to crash (Segmentation fault) when setting the caption in SDL like this:

SDL_WM_SetCaption("Wolfenstein 3D", NULL);

uint32_t length = strlen(name) + strlen(icon) + 2;

@klange
Copy link
Owner

klange commented Apr 18, 2023

Despite a null check later in the function, yutani_window_advertise_icon is not intended to accept NULL for the icon; clients should use yutani_window_advertise instead. The bug lies in the SDL backend: TOARU_SetCaption should be choosing yutani_window_advertise if icon is NULL. I would transfer this issue to the SDL fork, but I don't seem to have issues enabled for that repository.

@mxlgv
Copy link
Author

mxlgv commented Apr 18, 2023

In that case, this if is redundant:

if (icon) {

@klange
Copy link
Owner

klange commented Apr 18, 2023

Yeah. Maybe it should support a NULL icon... and it should probably also support a NULL name, which it fails to do in the same way... :\

@mxlgv
Copy link
Author

mxlgv commented Apr 25, 2023

Will you fix it? In my opinion, the fix is ​​quite obvious.

@klange
Copy link
Owner

klange commented Apr 26, 2023

I've got a fix pending on the SDL side. Still thinking about what I want to do here. Falling back to the no-icon form is likely the right choice, though I am also thinking about what should be done in both functions if the title is NULL - perhaps a signal to remove the window from the advertised window list.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants