* ip/torrent crash
@ 2019-01-07 10:22 qwx
0 siblings, 0 replies; only message in thread
From: qwx @ 2019-01-07 10:22 UTC (permalink / raw)
To: 9front
Hello,
I'm trying to download this torrent from: https://archive.org/details/idgames/
torrent(1) crashes at /sys/src/cmd/ip/torrent.c:205 because f == nil.
Command:
; hget https://ia600406.us.archive.org/5/items/idgames/idgames_archive.torrent \
| ip/torrent -pv | aux/statusbar idgames
From debug prints, when traversing the files list, f->off + f->len == off,
rather than f->off + f->len > off, so we don't break out of the loop and f
is set to nil.
The below patch allows me to download the torrent.
Does the patch make sense?
Thanks,
qwx
diff -r b048db97b5ea sys/src/cmd/ip/torrent.c
--- a/sys/src/cmd/ip/torrent.c Fri Jan 04 02:51:29 2019 +0100
+++ b/sys/src/cmd/ip/torrent.c Mon Jan 07 11:11:35 2019 +0100
@@ -200,7 +200,7 @@
off = (vlong)index * (vlong)blocksize;
off += poff;
for(f = files; f; f = f->next)
- if((f->off+f->len) > off)
+ if((f->off+f->len) >= off)
break;
off -= f->off;
n = ((off + len) > f->len) ? f->len - off : len;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-01-07 10:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07 10:22 ip/torrent crash qwx
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).