]> git.sesse.net Git - vlc/blobdiff - modules/meta_engine/taglib.cpp
id3tag: p_demux->p_private has been malloc()ed by the demuxer, so keep the pointer
[vlc] / modules / meta_engine / taglib.cpp
index bdbdb5877e71d5f899dc94bf7d9a698c8577e5ec..eb421349c9b5d9140cb2d47bfe4ffbb3dbbbdef2 100644 (file)
@@ -119,6 +119,18 @@ static void DetectImage( FileRef f, demux_t *p_demux )
             ByteVector p_data_taglib; const char *p_data; int i_data;
 
             psz_mime = p_apic->mimeType().toCString(true);
+
+            /* some old iTunes version not only sets incorrectly the mime type
+             * but also embeds incorrectly the image.
+             * Recent versions seem to behave correctly */
+            if( !strncmp( psz_mime, "PNG", 3 ) )
+            {
+                msg_Warn( p_demux,
+                    "%s: Invalid picture embedded by broken iTunes version",
+                    f.file()->name() );
+                break;
+            }
+
             psz_description = p_apic->description().toCString(true);
             psz_name = psz_description;
 
@@ -179,6 +191,7 @@ static void DetectImage( FileRef f, demux_t *p_demux )
         TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
         p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
                 psz_description, p_data, i_data );
+        free( p_data );
 
         TAB_APPEND_CAST( (input_attachment_t**),
                 p_demux_meta->i_attachments, p_demux_meta->attachments,