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

wlr_output_get_primary_formats returning NULL not handled (causing segfault) #8496

Open
sertonix opened this issue Dec 10, 2024 · 2 comments
Labels
bug Not working as intended
Milestone

Comments

@sertonix
Copy link

Please read the following before submitting:

  • Please do NOT submit bug reports for questions. Ask questions on IRC at #sway on Libera Chat.
  • Proprietary graphics drivers, including nvidia, are not supported. Please use the open source equivalents, such as nouveau, if you would like to use Sway.
  • Please do NOT submit issues for information from the github wiki. The github wiki is community maintained and therefore may contain outdated information, scripts that don't work or obsolete workarounds.
    If you fix a script or find outdated information, don't hesitate to adjust the wiki page.

Please fill out the following:

  • Sway Version: 1.10

  • Debug Log: sway.log

  • Configuration File: xwayland disable

  • Stack Trace: sway-bt.log

  • Description:

If the wlroots documentation is correct wlr_output_get_primary_formats may return NULL (doc). It looks like this is not handled correctly at

wlr_output_get_primary_formats(wlr_output, WLR_BUFFER_CAP_DMABUF);
which passes the return value to wlr_drm_format_set_get without a NULL check. wlroots then tries to dereference the pointer and segfaults (drm_format_set.c#L32).

I wasn't able to create a reproducer that I can share but I hope the analysis is enough.

@sertonix sertonix added the bug Not working as intended label Dec 10, 2024
@sertonix sertonix changed the title wlr_output_get_primary_formats returning NULL not handled wlr_output_get_primary_formats returning NULL not handled (causing segfault) Dec 10, 2024
@emersion
Copy link
Member

Indeed! We should add a NULL check right before wlr_drm_format_set_get(). Would you be willing to send a patch?

@sertonix
Copy link
Author

sertonix commented Dec 10, 2024

I don't know in which line the NULL check belongs and what should be done in that case. So I would prefer to leave that to the experts. Hope that is ok.

@emersion emersion added this to the 1.10.1 milestone Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

2 participants