Crash in mount_get_mountpoint when >128 mounts exist
In https://code.videolan.org/videolan/libbluray/blob/master/src/file/mount_darwin.c#L48, a buffer for 128 statfs structs is created. On line 51, fs_count
is set to the integer return value of getfsstat(...)
, and then fs_count
is used to loop over the 128 items in the buffer. But if fs_count
returns more than 128 records, that will cause the loop to exceed the length of the buffer and crash. This occurs in the wild on systems with more than 128 mount points present. I imagine that environment doesn't happen too often, but our machines at work have about 175 mount points, adding one or two each year.
I'd open a MR, but I'm not sure what the best solution is. Clearly just increasing the size of the buffer will "fix" it, but only up to whatever increment is chosen. Is there a maximum number of mounts that can possibly exist? Or can the buffer size be set based on fs_count
? Just some thoughts.
(I happened upon this because this bug causes Handbrake 1.2.2 to crash on macOS 10.14.6.)
Thanks!