[librsvg: 17/19] Test that files with big viewBox don't overflow the dimensions API



commit 953d121ec7c0397e1f2b22224e850ceb2fae6b44
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Apr 28 17:03:39 2020 -0500

    Test that files with big viewBox don't overflow the dimensions API

 tests/fixtures/render-crash/591-vbox-overflow.svg | 11 +++++++++++
 tests/src/cmdline/rsvg_convert.rs                 |  9 +++++++++
 2 files changed, 20 insertions(+)
---
diff --git a/tests/fixtures/render-crash/591-vbox-overflow.svg 
b/tests/fixtures/render-crash/591-vbox-overflow.svg
new file mode 100644
index 00000000..1cee7759
--- /dev/null
+++ b/tests/fixtures/render-crash/591-vbox-overflow.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg ion="1.1" baseProfile="b" id="svg-root"
+  width="100%" height="100%" viewBox="0 0 4822222222222222222220 360"
+  xmlns="http://www.w3.org/2000/svg"; xmlns:xlink="httk">
+  <g>
+    <g opacity="0.5">
+  <rect x="60" y="230" width="80" height="40" fill="+0000ff" opacity=".5"/>
+  <rect x="71" y="240" width="80" height="40" fill="#00ff00" opacity=".5"/>
+</g>
+  </g>
+</svg>
diff --git a/tests/src/cmdline/rsvg_convert.rs b/tests/src/cmdline/rsvg_convert.rs
index 9e4c575f..fa0cb941 100644
--- a/tests/src/cmdline/rsvg_convert.rs
+++ b/tests/src/cmdline/rsvg_convert.rs
@@ -677,6 +677,15 @@ fn keep_aspect_ratio_short_option() {
         .stdout(file::is_png().with_size(125, 500));
 }
 
+#[test]
+fn overflowing_size_is_detected() {
+    let input = Path::new("fixtures/render-crash/591-vbox-overflow.svg");
+    RsvgConvert::new_with_input(input)
+        .assert()
+        .failure()
+        .stderr(contains("Could not get dimensions").trim());
+}
+
 #[test]
 fn keep_image_data_option() {
     RsvgConvert::accepts_option("--keep-image-data");


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