[vlc-commits] demux/image: check that seek succeeds

Rémi Denis-Courmont git at videolan.org
Sun Mar 3 10:25:13 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  3 10:48:19 2019 +0200| [c94c3028e72a3090e29c80d1537745f7c85655e8] | committer: Rémi Denis-Courmont

demux/image: check that seek succeeds

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c94c3028e72a3090e29c80d1537745f7c85655e8
---

 modules/demux/image.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/image.c b/modules/demux/image.c
index 00ed643eb7..f438bcdc56 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -430,8 +430,7 @@ static bool IsWebP(stream_t *s)
     if (memcmp(&header[8], "WEBPVP8 ", 8))
         return false;
     /* skip headers */
-    vlc_stream_Seek(s, 20);
-    return true;
+    return vlc_stream_Seek(s, 20) == 0;
 }
 
 static bool IsSpiff(stream_t *s)
@@ -558,10 +557,11 @@ static bool IsTarga(stream_t *s)
         return false;
 
     const uint8_t *footer;
-    bool is_targa = vlc_stream_Peek(s, &footer, 26) >= 26 &&
-                    !memcmp(&footer[8], "TRUEVISION-XFILE.\x00", 18);
-    vlc_stream_Seek(s, position);
-    return is_targa;
+    if (vlc_stream_Peek(s, &footer, 26) < 26
+     || memcmp(&footer[8], "TRUEVISION-XFILE.\x00", 18))
+        return false;
+
+    return vlc_stream_Seek(s, position) == 0;
 }
 
 typedef struct {



More information about the vlc-commits mailing list