[librsvg] gitlab#152 - Fix detection of image type in data: with no MIME type.



commit 745a35066e944021f475f24d9615fc5f6131dfee
Author: Andreas Smas <andreas lonelycoder com>
Date:   Mon Jan 15 19:32:29 2018 -0600

    gitlab#152 - Fix detection of image type in data: with no MIME type.
    
    https://gitlab.gnome.org/GNOME/librsvg/issues/152

 rsvg-io.c                                                 |   2 +-
 .../reftests/bugs/152-image-data-with-no-mimetype-ref.png | Bin 0 -> 184 bytes
 .../reftests/bugs/152-image-data-with-no-mimetype.svg     |   7 +++++++
 3 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/rsvg-io.c b/rsvg-io.c
index 79c7863..de6d61f 100644
--- a/rsvg-io.c
+++ b/rsvg-io.c
@@ -87,7 +87,7 @@ rsvg_decode_data_uri (const char *uri,
 
     if (comma && comma != start) {
         /* Deal with MIME type / params */
-        if (comma > start + BASE64_INDICATOR_LEN && 
+        if (comma >= start + BASE64_INDICATOR_LEN && 
             !g_ascii_strncasecmp (comma - BASE64_INDICATOR_LEN, BASE64_INDICATOR, BASE64_INDICATOR_LEN)) {
             end = comma - BASE64_INDICATOR_LEN;
             base64 = TRUE;
diff --git a/tests/fixtures/reftests/bugs/152-image-data-with-no-mimetype-ref.png 
b/tests/fixtures/reftests/bugs/152-image-data-with-no-mimetype-ref.png
new file mode 100644
index 0000000..f64627e
Binary files /dev/null and b/tests/fixtures/reftests/bugs/152-image-data-with-no-mimetype-ref.png differ
diff --git a/tests/fixtures/reftests/bugs/152-image-data-with-no-mimetype.svg 
b/tests/fixtures/reftests/bugs/152-image-data-with-no-mimetype.svg
new file mode 100644
index 0000000..d98053d
--- /dev/null
+++ b/tests/fixtures/reftests/bugs/152-image-data-with-no-mimetype.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg";
+     xmlns:xlink="http://www.w3.org/1999/xlink";
+     width="100" height="100" viewBox="0 0 100 100" version="1.1">
+  <image width="16" height="16" preserveAspectRatio="none"
+        
xlink:href="data:;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAFklEQVQoz2P8z0AaYGIY1TCqYdhqAABALgEfsZDCTQAAAABJRU5ErkJggg=="/>
+</svg>


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