[easytag/easytag-2-2] Check for a valid Vorbis comment image MIME type
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/easytag-2-2] Check for a valid Vorbis comment image MIME type
- Date: Sun, 4 Jan 2015 18:28:56 +0000 (UTC)
commit ac83ba5cf9ac50af37325cbba698e0d73a6c15ec
Author: David King <amigadave amigadave com>
Date: Sun Jan 4 12:07:19 2015 +0000
Check for a valid Vorbis comment image MIME type
src/ogg_tag.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/ogg_tag.c b/src/ogg_tag.c
index a043d8d..661b84f 100644
--- a/src/ogg_tag.c
+++ b/src/ogg_tag.c
@@ -594,9 +594,30 @@ et_add_file_tags_from_vorbis_comments (vorbis_comment *vc, File_Tag *FileTag,
goto invalid_picture;
}
+ /* Check for a valid MIME type. */
+ if (mimelen > 0)
+ {
+ const gchar *mime;
+
+ mime = (const gchar *)&decoded_ustr[bytes_pos];
+
+ /* TODO: Check for "-->" when adding linked image support. */
+ if (strncmp (mime, "image/", mimelen) != 0
+ && strncmp (mime, "image/png", mimelen) != 0
+ && strncmp (mime, "image/jpeg", mimelen) != 0)
+ {
+ gchar *mime_str;
+
+ mime_str = g_strndup (mime, mimelen);
+ g_debug ("Invalid Vorbis comment image MIME type: %s",
+ mime_str);
+
+ g_free (mime_str);
+ goto invalid_picture;
+ }
+ }
+
/* Skip over the MIME type, as gdk-pixbuf does not use it. */
- /* TODO: Check for one of "image/", "image/png", "image/jpeg" and "-->"
- * (the check for "", length 0, is already covered). */
bytes_pos += mimelen;
/* Reading description */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]