Skip to content

Commit

Permalink
Fix crash caused by invalid poll descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
st8ed committed Feb 5, 2022
1 parent a460ba8 commit 414d880
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mopidy_alsamixer/mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import math
import random
import select
import struct
import time

import alsaaudio
Expand Down Expand Up @@ -226,10 +227,16 @@ def __init__(self, mixer, parent):
self._mixer = mixer
self._parent = parent

# FIXME: Remove when a new version of pyalsaaudio is released
# See https://github.com/larsimmisch/pyalsaaudio/pull/108
def check_fd(fd):
return fd != -1 and fd != struct.unpack("I", b"\xFF\xFF\xFF\xFF")[0]

super().__init__(
fds=tuple(
(fd, event_mask | select.EPOLLET)
for (fd, event_mask) in self._mixer.polldescriptors()
if check_fd(fd)
)
)

Expand Down

0 comments on commit 414d880

Please sign in to comment.