[librsvg/librsvg-2.44] Fix upper bound in PixelRectangle get_pixel clamp



commit 009bbacb050a452b4ea6f5163b4a43c54366ea23
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Sep 15 12:40:34 2018 +0300

    Fix upper bound in PixelRectangle get_pixel clamp

 rsvg_internals/src/surface_utils/iterators.rs       |   4 ++--
 .../reftests/svg1.1/filters-conv-01-f-ref.png       | Bin 49853 -> 49435 bytes
 .../reftests/svg1.1/filters-conv-02-f-ref.png       | Bin 32837 -> 33142 bytes
 .../reftests/svg1.1/filters-conv-04-f-ref.png       | Bin 75911 -> 76866 bytes
 .../reftests/svg1.1/filters-conv-05-f-ref.png       | Bin 9265 -> 9269 bytes
 .../render-crash/PixelRectangle-duplicate-crash.svg |   7 +++++++
 6 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/surface_utils/iterators.rs b/rsvg_internals/src/surface_utils/iterators.rs
index a3c8b8c5..ea74b9ed 100644
--- a/rsvg_internals/src/surface_utils/iterators.rs
+++ b/rsvg_internals/src/surface_utils/iterators.rs
@@ -138,8 +138,8 @@ impl<'a> Iterator for PixelRectangle<'a> {
                             a: 0,
                         },
                         EdgeMode::Duplicate => {
-                            let x = clamp(x, self.bounds.x0, self.bounds.x1);
-                            let y = clamp(y, self.bounds.y0, self.bounds.y1);
+                            let x = clamp(x, self.bounds.x0, self.bounds.x1 - 1);
+                            let y = clamp(y, self.bounds.y0, self.bounds.y1 - 1);
                             self.surface.get_pixel(x as u32, y as u32)
                         }
                         EdgeMode::Wrap => {
diff --git a/tests/fixtures/reftests/svg1.1/filters-conv-01-f-ref.png 
b/tests/fixtures/reftests/svg1.1/filters-conv-01-f-ref.png
index 3fbc6c0b..55948870 100644
Binary files a/tests/fixtures/reftests/svg1.1/filters-conv-01-f-ref.png and 
b/tests/fixtures/reftests/svg1.1/filters-conv-01-f-ref.png differ
diff --git a/tests/fixtures/reftests/svg1.1/filters-conv-02-f-ref.png 
b/tests/fixtures/reftests/svg1.1/filters-conv-02-f-ref.png
index 6120ce8e..5b56faf4 100644
Binary files a/tests/fixtures/reftests/svg1.1/filters-conv-02-f-ref.png and 
b/tests/fixtures/reftests/svg1.1/filters-conv-02-f-ref.png differ
diff --git a/tests/fixtures/reftests/svg1.1/filters-conv-04-f-ref.png 
b/tests/fixtures/reftests/svg1.1/filters-conv-04-f-ref.png
index bfae501a..4d852796 100644
Binary files a/tests/fixtures/reftests/svg1.1/filters-conv-04-f-ref.png and 
b/tests/fixtures/reftests/svg1.1/filters-conv-04-f-ref.png differ
diff --git a/tests/fixtures/reftests/svg1.1/filters-conv-05-f-ref.png 
b/tests/fixtures/reftests/svg1.1/filters-conv-05-f-ref.png
index 999c72f5..c5a05f1a 100644
Binary files a/tests/fixtures/reftests/svg1.1/filters-conv-05-f-ref.png and 
b/tests/fixtures/reftests/svg1.1/filters-conv-05-f-ref.png differ
diff --git a/tests/fixtures/render-crash/PixelRectangle-duplicate-crash.svg 
b/tests/fixtures/render-crash/PixelRectangle-duplicate-crash.svg
new file mode 100644
index 00000000..7919be95
--- /dev/null
+++ b/tests/fixtures/render-crash/PixelRectangle-duplicate-crash.svg
@@ -0,0 +1,7 @@
+<svg>
+  <filter id="f">
+    <feConvolveMatrix kernelMatrix="0 0 0 0-0 0 0 0 0"/>
+  </filter>
+  
+  <rect width="1" height="1" filter="url(#f)"/>
+</svg>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]