summaryrefslogtreecommitdiffstats
path: root/options/options.h
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-11-02 18:28:53 -0500
committerDudemanguy <random342@airmail.cc>2021-11-03 00:32:27 +0000
commit5512f53722a46dd7b4844ca8f7e47b5fed2d7259 (patch)
treee876f08035f9cb6db9e6850a1cf7560fd5a12f22 /options/options.h
parent171627b267bb741fafe0d06bf4dc9c6b9fe4571d (diff)
downloadmpv-5512f53722a46dd7b4844ca8f7e47b5fed2d7259.tar.bz2
mpv-5512f53722a46dd7b4844ca8f7e47b5fed2d7259.tar.xz
player: fix autofit/geometry related segfault
Back when runtime updating of autofit/geometry was added for wayland and x11 (commits: 4445ac828dca0298543103094357e64f8828ef56 and ced92ba607ebd98687b26ef3d8c09d5f6e22cf4b respectively), the naive assumption was that window-related geometry would always be available. While this is true 99% of the time, this isn't a guarentee. It is possible for certain things such as loading shaders to delay starting up the player. This causes autofit/geometry options to be registered as a runtime update and triggers VOCTRL_VO_OPTS_CHANGED. This ends up calling some geometry-related functions but this happens before the actual values are available. Hence, a nullptr was accessed which segfaults. At least one user experienced this with a combination of options in wayland but in theory the same thing could happen under x11. The fix is simple. Just be sure to check that the required geometry is available before doing any calculations. In wayland, this would be wl->current_output. Additionally add an assert to set_geometry (we should never use this function without wl->current_output) to be extra sure. In x11, the check is on x11->window. Later when the reconfig for each backend actually happens, the autofit/geometry set by the user happens anyway so ignoring it in this case does no harm. Fixes #9381.
Diffstat (limited to 'options/options.h')
0 files changed, 0 insertions, 0 deletions