[tracker/tracker-0.10] tracker-extract: Check header bytes for JPeg files
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] tracker-extract: Check header bytes for JPeg files
- Date: Mon, 1 Aug 2011 16:21:37 +0000 (UTC)
commit 5a52310507cddde1b97c527c4f7fc10397b6f9fa
Author: Philip Van Hoof <philip codeminded be>
Date: Thu Jul 28 14:37:23 2011 +0200
tracker-extract: Check header bytes for JPeg files
Fixes NB#271389.
src/tracker-extract/tracker-albumart-pixbuf.c | 5 +++--
src/tracker-extract/tracker-albumart-qt.cpp | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-extract/tracker-albumart-pixbuf.c b/src/tracker-extract/tracker-albumart-pixbuf.c
index fd743ba..4557b1c 100644
--- a/src/tracker-extract/tracker-albumart-pixbuf.c
+++ b/src/tracker-extract/tracker-albumart-pixbuf.c
@@ -67,8 +67,9 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
const gchar *buffer_mime,
const gchar *target)
{
- if (g_strcmp0 (buffer_mime, "image/jpeg") == 0 ||
- g_strcmp0 (buffer_mime, "JPG") == 0) {
+ if ((g_strcmp0 (buffer_mime, "image/jpeg") == 0 ||
+ g_strcmp0 (buffer_mime, "JPG") == 0) &&
+ (buffer && len > 2 && buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff)) {
g_debug ("Saving album art using raw data as uri:'%s'",
target);
diff --git a/src/tracker-extract/tracker-albumart-qt.cpp b/src/tracker-extract/tracker-albumart-qt.cpp
index e74213c..95cb3de 100644
--- a/src/tracker-extract/tracker-albumart-qt.cpp
+++ b/src/tracker-extract/tracker-albumart-qt.cpp
@@ -91,8 +91,9 @@ tracker_albumart_buffer_to_jpeg (const unsigned char *buffer,
const gchar *buffer_mime,
const gchar *target)
{
- if (g_strcmp0 (buffer_mime, "image/jpeg") == 0 ||
- g_strcmp0 (buffer_mime, "JPG") == 0) {
+ if ((g_strcmp0 (buffer_mime, "image/jpeg") == 0 ||
+ g_strcmp0 (buffer_mime, "JPG") == 0) &&
+ (buffer && len > 2 && buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff)) {
g_debug ("Saving album art using raw data as uri:'%s'",
target);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]