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

Invalid read on DestroyNotify #58

Open
Kycilak opened this issue Jan 16, 2024 · 0 comments · May be fixed by #59
Open

Invalid read on DestroyNotify #58

Kycilak opened this issue Jan 16, 2024 · 0 comments · May be fixed by #59

Comments

@Kycilak
Copy link

Kycilak commented Jan 16, 2024

Calling mlx_destroy_window through DestroyNotify hook causes invalid read. This is happening in this snippet:

if (win && ev.type == ClientMessage && ev.xclient.message_type == xvar->wm_protocols && ev.xclient.data.l[0] == xvar->wm_delete_window && win->hooks[DestroyNotify].hook)
win->hooks[DestroyNotify].hook(win->hooks[DestroyNotify].param);
if (win && ev.type < MLX_MAX_EVENT && win->hooks[ev.type].hook)
mlx_int_param_event[ev.type](xvar, &ev, win);

I think this is caused by the check of win->hooks[ev.type].hook at line 55 after win is freed in the previous line.

Kycilak added a commit to Kycilak/minilibx-linux that referenced this issue Jan 16, 2024
@Kycilak Kycilak linked a pull request Jan 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant