diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-04-04 17:06:35 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-04-04 17:06:35 +0200 |
commit | 4a9c1385f9f2ab8f0a5e8651bf51f29eeec201d8 (patch) | |
tree | 82015e4650f7d36cc06ac9e64f6a3ea33076c4a0 /plugins/artwork | |
parent | 71eca007f97a7b27a8d6029e5240501ab2db1519 (diff) |
restrict id3v2-embedded artwork to type 3 (front cover) and png/jpeg
Diffstat (limited to 'plugins/artwork')
-rw-r--r-- | plugins/artwork/artwork.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 3e4f36f2..e2151069 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -355,11 +355,22 @@ fetcher_thread (void *none) uint8_t *end = f->data + f->size; int enc = *data; data++; // enc - data = id3v2_skip_str (enc, data, end); // mime-type - if (!data) { + // mime-type must always be ASCII - hence enc is 0 here + uint8_t *mime_end = id3v2_skip_str (0, data, end); + if (!mime_end) { trace ("artwork: corrupted id3v2 APIC frame\n"); continue; } + if (strcasecmp (data, "image/jpeg") && strcasecmp (data, "image/png")) { + trace ("artwork: unsupported mime type: %s\n", data); + continue; + } + if (*mime_end != 3) { + trace ("artwork: picture type=%d, skipped: %s\n", *mime_end); + continue; + } + trace ("artwork: mime-type=%s, picture type: %d\n", data, *mime_end); + data = mime_end; data++; // picture type data = id3v2_skip_str (enc, data, end); // description if (!data) { |