mozilla / audioipc

Cubeb Audio Remoting For Gecko
10 stars 17 forks source link

Handle up to 2 fds per decoded `cmsghdr` buffer. #143

Closed kinetiknz closed 2 years ago

kinetiknz commented 2 years ago

This isn't the most elegant fix, but it's a fiddly issue. I may revisit this again later if I think of a cleaner way to handle it.

On some 64-bit platforms, due to struct alignment requirements, the smallest cmsghdr has capacity for 2 fds even if only 1 is expected/requested. Due to buffer coalescing, multiple sendmsg calls may arrive via a single recvmsg, resulting in a situation where the cmsghdr contains multiple (maximum 2) fds.

This addresses BMO 1750345.