[vlc-commits] [Git][videolan/vlc][3.0.x] demux: image: check available peek size in isJfif

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Sep 8 06:22:01 UTC 2026



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


Commits:
ff57f514 by François Cartegnie at 2026-09-08T06:07:52+00:00
demux: image: check available peek size in isJfif

fix #30080

(cherry picked from commit c32e43bfd42358ea67a64b0eef125cf6f4b9e7cf)

- - - - -


1 changed file:

- modules/demux/image.c


Changes:

=====================================
modules/demux/image.c
=====================================
@@ -405,19 +405,21 @@ static bool IsJfif(stream_t *s)
         uint8_t marker = FindJpegMarker(&position, header, size);
         switch (marker) {
             case 0xe2: { // ICC Profile
+                if (position + 14 > size)
+                    return false;
                 size_t icc_size = GetWBE(&header[position]);
-                position += 2;
-                if (position + 12 > size)
+                if (icc_size < 2)
                     return false;
+                position += 2;
                 if (memcmp(&header[position], "ICC_PROFILE\0", 12))
                     return false;
                 position += icc_size - 2;
                 break;
             }
             case 0xe0: { // APP0
-                position += 2;  /* Skip size */
-                if (position + 5 > size)
+                if (position + 7 > size)
                     return false;
+                position += 2;  /* Skip size */
                 return (memcmp(&header[position], "JFIF\0", 5) == 0);
             }
             default:



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ff57f514f672ea9e11d19fa7196e1848a77b7aa9
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list