[vlc-commits] [Git][videolan/vlc][3.0.x] demux: image: detect ICC profile before JFIF data

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jun 11 14:45:51 UTC 2024



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
ee032a34 by Steve Lhomme at 2024-06-11T14:10:00+00:00
demux: image: detect ICC profile before JFIF data

Fixes #18857

(cherry picked from commit 5ffd36ffa26a83ae498373f7d0ace1d82ab952f4)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


1 changed file:

- modules/demux/image.c


Changes:

=====================================
modules/demux/image.c
=====================================
@@ -392,7 +392,7 @@ static uint8_t FindJpegMarker(size_t *position, const uint8_t *data, size_t size
 static bool IsJfif(stream_t *s)
 {
     const uint8_t *header;
-    ssize_t peek = vlc_stream_Peek(s, &header, 256);
+    ssize_t peek = vlc_stream_Peek(s, &header, 4096);
     if(peek < 256)
         return false;
     size_t size = (size_t) peek;
@@ -400,6 +400,16 @@ static bool IsJfif(stream_t *s)
 
     if (FindJpegMarker(&position, header, size) != 0xd8)
         return false;
+    if (FindJpegMarker(&position, header, size) == 0xe2) // ICC Profile
+    {
+        size_t icc_size = GetWBE(&header[position]);
+        position += 2;
+        if (position + 12 > size)
+            return false;
+        if (memcmp(&header[position], "ICC_PROFILE\0", 12))
+            return false;
+        position += icc_size - 2;
+    }
     if (FindJpegMarker(&position, header, size) != 0xe0)
         return false;
     position += 2;  /* Skip size */



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ee032a34259c3644c73d94c712e0a53b26f5dba9

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ee032a34259c3644c73d94c712e0a53b26f5dba9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list