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

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Sep 1 08:51:35 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c32e43bf by François Cartegnie at 2026-09-01T08:35:59+00:00
demux: image: check available peek size in isJfif

fix #30080

- - - - -


1 changed file:

- modules/demux/image.c


Changes:

=====================================
modules/demux/image.c
=====================================
@@ -422,19 +422,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/c32e43bfd42358ea67a64b0eef125cf6f4b9e7cf

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c32e43bfd42358ea67a64b0eef125cf6f4b9e7cf
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