summaryrefslogtreecommitdiffstats
path: root/tiny_skia
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-17 19:35:57 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-17 19:35:57 +0100
commitc8f637fc16099c70836574425a6df20a3e2fa801 (patch)
tree44fc1c8cbad8ac48d6943acf47f91746997dd21f /tiny_skia
parentcaf2836b1b15bff6e8a2ea72441d67f297eb8707 (diff)
downloadiced-c8f637fc16099c70836574425a6df20a3e2fa801.tar.gz
iced-c8f637fc16099c70836574425a6df20a3e2fa801.tar.bz2
iced-c8f637fc16099c70836574425a6df20a3e2fa801.zip
Fix panic rendering an out of bounds clip in `iced_tiny_skia`
Diffstat (limited to 'tiny_skia')
-rw-r--r--tiny_skia/src/backend.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs
index ba063f4e..271d026f 100644
--- a/tiny_skia/src/backend.rs
+++ b/tiny_skia/src/backend.rs
@@ -267,6 +267,14 @@ impl Backend {
Primitive::Clip { bounds, content } => {
let bounds = (*bounds + translation) * scale_factor;
+ if bounds.x + bounds.width <= 0.0
+ || bounds.y + bounds.height <= 0.0
+ || bounds.x as u32 >= pixels.width()
+ || bounds.y as u32 >= pixels.height()
+ {
+ return;
+ }
+
adjust_clip_mask(clip_mask, pixels, bounds);
self.draw_primitive(