[easytag] Check for a valid Vorbis comment image MIME type
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Check for a valid Vorbis comment image MIME type
- Date: Sun, 4 Jan 2015 14:38:12 +0000 (UTC)
commit 608a91f515004efe1ad44534e7cafc79c93e08e5
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/tags/ogg_tag.c | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/tags/ogg_tag.c b/src/tags/ogg_tag.c
index 887997a..291b7d6 100644
--- a/src/tags/ogg_tag.c
+++ b/src/tags/ogg_tag.c
@@ -580,9 +580,30 @@ et_add_file_tags_from_vorbis_comments (vorbis_comment *vc,
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]