Commit bbbfbfcd authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Carlos Garnacho

Fix a leak and a possible memory corruption. Do not make id3 tags parsers

2009-04-02  Carlos Garnacho  <carlos@imendio.com>

        * src/tracker-extract/tracker-extract-gstreamer.c
        (tracker_extract_gstreamer): Fix a leak and a possible memory
        corruption.
        * src/tracker-extract/tracker-extract-mp3.c (extract_mp3): Do not make
        id3 tags parsers read invalid memory if file size is above
        MAX_FILE_READ.
        * src/tracker-extract/tracker-extract-png.c (extract_png): Free
        correctly the ending info pointer.
        * src/tracker-extract/tracker-extract.c (get_file_metadata): Plug a
        leak, caused when no extractor was found.
        * src/tracker-extract/tracker-main.c: Initialize the quit timeout ID
        to 0, so we don't try to remove nonexistent sources.

svn path=/trunk/; revision=3167
parent 55346cf1
2009-04-02 Carlos Garnacho <carlos@imendio.com>
* src/tracker-extract/tracker-extract-gstreamer.c
(tracker_extract_gstreamer): Fix a leak and a possible memory
corruption.
* src/tracker-extract/tracker-extract-mp3.c (extract_mp3): Do not make
id3 tags parsers read invalid memory if file size is above
MAX_FILE_READ.
* src/tracker-extract/tracker-extract-png.c (extract_png): Free
correctly the ending info pointer.
* src/tracker-extract/tracker-extract.c (get_file_metadata): Plug a
leak, caused when no extractor was found.
* src/tracker-extract/tracker-main.c: Initialize the quit timeout ID
to 0, so we don't try to remove nonexistent sources.
2009-04-02 Michael Biebl <mbiebl@gmail.com>
* src/plugins/evolution/Makefile.am, src/plugins/kmail/Makefile.am,
......
......@@ -639,7 +639,6 @@ tracker_extract_gstreamer (const gchar *uri,
ExtractMime type)
{
MetadataExtractor *extractor;
gchar *mrl;
g_return_if_fail (uri);
g_return_if_fail (metadata);
......@@ -732,7 +731,6 @@ tracker_extract_gstreamer (const gchar *uri,
extractor->bus = gst_pipeline_get_bus (GST_PIPELINE (extractor->pipeline));
gst_bus_add_watch (extractor->bus, metadata_bus_async_cb, extractor);
mrl = g_strconcat ("file://", uri, NULL);
g_object_set (G_OBJECT (extractor->filesrc), "location", uri, NULL);
gst_element_set_state (extractor->pipeline, GST_STATE_PAUSED);
......@@ -741,12 +739,6 @@ tracker_extract_gstreamer (const gchar *uri,
extract_metadata (extractor, metadata);
gst_element_set_state (extractor->pipeline, GST_STATE_NULL);
gst_object_unref (extractor->bus);
gst_object_unref (GST_OBJECT (extractor->pipeline));
g_main_loop_unref (extractor->loop);
g_slice_free (MetadataExtractor, extractor);
/* Save embedded art */
if (extractor->album_art_data && extractor->album_art_size) {
#ifdef HAVE_GDKPIXBUF
......@@ -765,6 +757,12 @@ tracker_extract_gstreamer (const gchar *uri,
#endif /* HAVE_GDKPIXBUF */
}
gst_element_set_state (extractor->pipeline, GST_STATE_NULL);
gst_object_unref (extractor->bus);
gst_object_unref (GST_OBJECT (extractor->pipeline));
g_main_loop_unref (extractor->loop);
g_slice_free (MetadataExtractor, extractor);
if (type == EXTRACT_MIME_IMAGE) {
if (!g_hash_table_lookup (metadata, "Image:Date")) {
struct stat st;
......
......@@ -1513,7 +1513,7 @@ extract_mp3 (const gchar *filename,
size = tracker_file_get_size (filename);
if (size == 0) {
if (size == 0 || size > MAX_FILE_READ) {
return;
}
......
......@@ -183,14 +183,12 @@ extract_png (const gchar *filename,
end_ptr = png_create_info_struct (png_ptr);
if (!end_ptr) {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
png_destroy_read_struct (&png_ptr, &end_ptr, NULL);
tracker_file_close (f, FALSE);
return;
}
if (setjmp (png_jmpbuf (png_ptr))) {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
png_destroy_read_struct (&png_ptr, &end_ptr, NULL);
png_destroy_read_struct (&png_ptr, &info_ptr, &end_ptr);
tracker_file_close (f, FALSE);
return;
}
......@@ -207,8 +205,7 @@ extract_png (const gchar *filename,
&interlace_type,
&compression_type,
&filter_type)) {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
png_destroy_read_struct (&png_ptr, &end_ptr, NULL);
png_destroy_read_struct (&png_ptr, &info_ptr, &end_ptr);
tracker_file_close (f, FALSE);
return;
}
......@@ -259,8 +256,7 @@ extract_png (const gchar *filename,
g_free (date);
}
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
png_destroy_read_struct (&png_ptr, &end_ptr, NULL);
png_destroy_read_struct (&png_ptr, &info_ptr, &end_ptr);
tracker_file_close (f, FALSE);
}
}
......
......@@ -326,14 +326,16 @@ get_file_metadata (TrackerExtract *extract,
tracker_dbus_request_comment (request_id,
" Found %d metadata items",
g_hash_table_size (values));
g_free (path_in_locale);
g_free (mime_used);
return values;
}
}
g_free (mime_used);
tracker_dbus_request_comment (request_id,
" Could not find any extractors to handle metadata type");
} else {
......
......@@ -65,7 +65,7 @@
#define QUIT_TIMEOUT 30 /* 1/2 minutes worth of seconds */
static GMainLoop *main_loop;
static guint quit_timeout_id;
static guint quit_timeout_id = 0;
static gboolean version;
static gint verbosity = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment