From 73b3ff8a0fab66960df3672db6451652651de4c4 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 17 Aug 2008 17:27:56 +0000 Subject: [PATCH] Fix to prevent Deluge from segfaulting when trying to autoadd an incomplete torrent file --- ChangeLog | 1 + deluge/core/autoadd.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c5448755c..1983f3222 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ Deluge 0.9.07 - "1.0.0_RC7" (In Development) Core: * Fix loading torrents from state when fastresume file is missing * Fix UPnP + * Fix to prevent Deluge from segfaulting when trying to autoadd an incomplete torrent file GtkUI: * Add 'edit' to edit trackers dialog diff --git a/deluge/core/autoadd.py b/deluge/core/autoadd.py index 1ad88ad7d..a4c40314b 100644 --- a/deluge/core/autoadd.py +++ b/deluge/core/autoadd.py @@ -42,7 +42,7 @@ MAX_NUM_ATTEMPTS = 10 class AutoAdd(component.Component): def __init__(self): - component.Component.__init__(self, "AutoAdd", depend=["TorrentManager"], interval=3000) + component.Component.__init__(self, "AutoAdd", depend=["TorrentManager"], interval=5000) # Get the core config self.config = ConfigManager("core.conf") @@ -100,6 +100,8 @@ class AutoAdd(component.Component): log.debug("Attempting to open %s for add.", filename) _file = open(filename, "rb") filedump = _file.read() + if not filedump: + raise RuntimeError, "Torrent is 0 bytes!" _file.close() except IOError, e: log.warning("Unable to open %s: %s", filename, e)