[tracker] Added some extra checks for size in mp3 extraction.



commit 7a71342e6426235d7835249b1483506ee25600d1
Author: Mikael Ottela <mikael ottela ixonos com>
Date:   Thu May 7 17:57:30 2009 +0300

    Added some extra checks for size in mp3 extraction.
---
 src/tracker-extract/tracker-extract-mp3.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 699c490..fc74e7c 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -319,10 +319,13 @@ read_id3v1_buffer (int fd, goffset size)
 	guint bytes_read;
 	guint rc;
 
-	if (lseek (fd, size-ID3V1_SIZE, SEEK_SET) < 0) {
+	if (size<128) {
 		return NULL;
 	}
 
+	if (lseek (fd, size-ID3V1_SIZE, SEEK_SET) < 0) {
+		return NULL;
+	}
 
 	buffer = g_malloc (ID3V1_SIZE);
 
@@ -481,6 +484,10 @@ get_id3 (const gchar *data,
 	const gchar *pos;
 	gchar buf[5];
 
+	if (!data) {
+		return FALSE;
+	}
+	
 	if (size < 128) {
 		return FALSE;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]