Skip to content

Commit

Permalink
Fix read return value check in buffer_release_thread
Browse files Browse the repository at this point in the history
Previously, we were reading 0 bytes and were passing uninitiaized value
to `switch`. Likely, not much changed in practice (all codepaths
were just terminating the thread, regardless of the success of the
`read`), but now we don't trigger undefined behavior.
  • Loading branch information
al42and committed Jan 11, 2025
1 parent 0c6f823 commit 8309514
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wayland-eglsurface.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ buffer_release_thread(void *args)
}

if (pfds[1].revents & POLLIN) {
if (read(pfds[1].fd, &cmd, sizeof(cmd) != sizeof(cmd))) {
if (read(pfds[1].fd, &cmd, sizeof(cmd)) != sizeof(cmd)) {
/* Reading an event from the app side failed. Bail. */
wl_display_cancel_read(wlDpy);
return NULL;
Expand Down

0 comments on commit 8309514

Please sign in to comment.