Skip to content

clutter/stage: Make paint_to_buffer use the correct texture/buffer size

Sebastian Keller requested to merge skeller/mutter:fix-paint-to-buffer into master

The size of the buffer the texture will be written to by paint_to_buffer() is determined based on meta_screen_cast_area_stream_src_get_specs() which uses roundf() to calculate the width and height after scaling. Because the size of the texture to be written to that buffer is calculated using ceilf(), it might exceed the allocated buffer when using fractional scaling.

In 3.36 paint_to_buffer() is used from capture_view() which also uses roundf() to allocate its buffer. Here this leads to a memory corruption resulting in a crash when taking screenshots of an area.

Fixes gnome-shell#2842 (closed)

Merge request reports

Loading