[tracker] 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-extract-mp3: Fix segfault when trying to process NULL ID3 tag
- Date: Thu, 18 Jul 2013 15:17:11 +0000 (UTC)
commit d35800235ce93842f626b39b6925a0654c83c3dc
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]