[tracker/tracker-0.16] tracker-extract-mp3: Fix segfault when trying to process NULL ID3 tag
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.16] tracker-extract-mp3: Fix segfault when trying to process NULL ID3 tag
- Date: Wed, 31 Jul 2013 22:31:09 +0000 (UTC)
commit 1ca440f2c05ac305c72914896c370981eeff5b79
Author: Jonatan PĂ„lsson <jonatan palsson pelagicore com>
Date: Thu Jul 18 16:15:57 2013 +0100
tracker-extract-mp3: Fix segfault when trying to process NULL ID3 tag
When calling g_convert with a missing codepage, it returns NULL, while not
setting an error (specifically, if the CP1252 code page is missing, a
segmentation fault occurs). This means id3v24_text_to_utf8 and
id3v2_text_to_utf8 may return NULL. If NULL is returned by these functions, do
not process this tag further.
src/tracker-extract/tracker-extract-mp3.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 9b154f9..d5aea57 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -1292,6 +1292,9 @@ get_id3v24_tags (id3v24frame frame,
word = id3v24_text_to_utf8 (data[pos], &data[pos + 1], csize - 1, info);
if (!tracker_is_empty_string (word)) {
g_strstrip (word);
+ } else {
+ /* Can't do anything without word. */
+ break;
}
#ifdef FRAME_ENABLE_TRACE
@@ -1480,8 +1483,12 @@ get_id3v23_tags (id3v24frame frame,
if (!tracker_is_empty_string (word)) {
g_strstrip (word);
+ } else {
+ /* Can't do anything without word. */
+ break;
}
+
#ifdef FRAME_ENABLE_TRACE
g_debug ("ID3v2.3: Frame is %d, word is %s", frame, word);
#endif /* FRAME_ENABLE_TRACE */
@@ -1625,6 +1632,9 @@ get_id3v20_tags (id3v2frame frame,
word = id3v2_text_to_utf8 (data[pos], &data[pos + 1], csize - 1, info);
if (!tracker_is_empty_string (word)) {
g_strstrip (word);
+ } else {
+ /* Can't do anything without word. */
+ return;
}
#ifdef FRAME_ENABLE_TRACE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]