libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 5461356b14332638353b7a4a94fb1d24b330043f
parent 0aae6984db8fd561d11b89247455acbc1815c725
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  9 Oct 2012 20:27:17 +0000

-trying to fix rare, random use-after-free if interacting with broken plugins

Diffstat:
Msrc/main/extractor.c | 8--------
Msrc/main/extractor_ipc_gnu.c | 3+++
Msrc/main/extractor_ipc_w32.c | 2++
3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/main/extractor.c b/src/main/extractor.c @@ -458,14 +458,6 @@ do_extract (struct EXTRACTOR_PluginList *plugins, plugin_off = 0; for (pos = plugins; NULL != pos; pos = pos->next) { - if ( (NULL == channels[plugin_off]) && - (-1 == pos->seek_request) ) - { - /* EXTRACTOR_IPC_channel_recv_ got a non-NULL channel (-1 == seek_request) - but set it to NULL; that means the channel had an IPC error and was closed; - so we need to update the plugin accordingly */ - pos->channel = NULL; - } plugin_off++; if ( (1 == pos->round_finished) || (NULL == pos->channel) ) diff --git a/src/main/extractor_ipc_gnu.c b/src/main/extractor_ipc_gnu.c @@ -28,6 +28,7 @@ #include "extractor_datasource.h" #include "extractor_logging.h" #include "extractor_plugin_main.h" +#include "extractor_plugins.h" #include "extractor_ipc.h" #include <dirent.h> #include <sys/types.h> @@ -372,6 +373,8 @@ EXTRACTOR_IPC_channel_destroy_ (struct EXTRACTOR_Channel *channel) LOG_STRERROR ("close"); if (0 != close (channel->cpipe_in)) LOG_STRERROR ("close"); + if (NULL != channel->plugin) + channel->plugin->channel = NULL; free (channel->mdata); free (channel); } diff --git a/src/main/extractor_ipc_w32.c b/src/main/extractor_ipc_w32.c @@ -599,6 +599,8 @@ EXTRACTOR_IPC_channel_destroy_ (struct EXTRACTOR_Channel *channel) free (channel->ov_write_buffer); channel->ov_write_buffer = NULL; } + if (NULL != channel->plugin) + channel->plugin->channel = NULL; free (channel->mdata); free (channel); }