ngl: Excessive memory usage when loading texture-scale nodes with non-integer bounds
Steps to reproduce
-
Open Gtk Node Editor with the NGL renderer.
-
Load a texture-scaled node with non-integer bounds in the Node Editor, for instance:
/* Modified example from testsuite/gsk/nodeparser/texture-scale-filters.node */
texture-scale {
texture: url('data:,<svg width="10" height="10" viewBox="0 0 10 10"><rect width="10" height="10" style="fill:red"/></svg>');
bounds: 0 0 100 100.1;
filter: trilinear;
}
- The memory usage of the application will quickly increase. In GTK Node Editor with the example shown above, memory usage will quickly increase from ~43 MB to > 110 MB before crashing.
In some extreme test cases, large scaled textures used all the memory in my computer. While porting Paper Clip to the latest Gtk/Adwaita versions, this Scaled_Node.node used all available memory and crashed my laptop.
Note that this issue does not happen with integer values, only with floating point ones.
Version information
- Gtk Version: 4.14.1
- OS: Fedora Linux 39.20240301.0 (Silverblue). Running under Flatpak in GNOME master runtime (commit 1a60f9c24e238a59182831a4f62284e7634bd71aa51f06a1325b8e47f414b872)
- Graphics: Intel HD Graphics 620 (KBL GT2)
- Windowing System: Wayland
- Renderer: NGL. The old GL renderer is not affected by this issue.
Backtrace
Stack trace generated by GDB: gdb.txt