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

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jun 7 03:15:32 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5ffd36ff by Steve Lhomme at 2024-06-07T02:54:00+00:00
demux: image: detect ICC profile before JFIF data

Fixes #18857

- - - - -


1 changed file:

- modules/demux/image.c


Changes:

=====================================
modules/demux/image.c
=====================================
@@ -409,7 +409,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;
@@ -417,6 +417,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/5ffd36ffa26a83ae498373f7d0ace1d82ab952f4

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5ffd36ffa26a83ae498373f7d0ace1d82ab952f4
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