[pan2] Bug 793228 nzb file with empty segment lists crash pan
- From: Petr Kovář <pmkovar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] Bug 793228 nzb file with empty segment lists crash pan
- Date: Sat, 10 Feb 2018 21:31:46 +0000 (UTC)
commit 29aad7ec8b2b0c74592342fcfa2aa3c830f9e592
Author: paul flinders org <paul flinders org>
Date: Thu Feb 8 21:28:07 2018 +0100
Bug 793228 nzb file with empty segment lists crash pan
NZB files which have empty segment lists crash pan (up to 0.144),
for me typically at the assertion on the last line of
Parts :: set_parts (around parts.cc line 237).
The problem is that "mc.parts" is not re-initialised for the new
list of segments if the first segment is not seen, depending on
the position in the file you will either get an incompletely
constructed PartBatch used (PartBatch relies on a default
constructor so packed_mids_len doesn't get initialised) or an
old list of segments could get re-used.
pan/tasks/nzb.cc | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/pan/tasks/nzb.cc b/pan/tasks/nzb.cc
index e3e8547..af890e5 100644
--- a/pan/tasks/nzb.cc
+++ b/pan/tasks/nzb.cc
@@ -113,6 +113,8 @@ namespace
gpointer user_data,
GError **error UNUSED)
{
+ static Quark null_mid;
+
MyContext& mc (*static_cast<MyContext*>(user_data));
if (!strcmp (element_name, "file")) {
@@ -123,7 +125,9 @@ namespace
else if (!strcmp (*k,"date")) mc.a.time_posted = strtoul(*v,0,10);
}
}
-
+ else if (!strcmp (element_name, "segments")) {
+ mc.parts.init (null_mid);
+ }
else if (!strcmp (element_name, "segment")) {
mc.bytes = 0;
mc.number = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]