guard against piece size or count of 0
This commit is contained in:
@@ -135,6 +135,9 @@ public class DownloadManager {
|
||||
else
|
||||
incompletes = new File(home, "incompletes")
|
||||
|
||||
if (json.pieceSizePow2 == null || json.pieceSizePow2 == 0)
|
||||
return // skip this download as it's corrupt anyway
|
||||
|
||||
Pieces pieces = getPieces(infoHash, (long)json.length, json.pieceSizePow2, sequential)
|
||||
|
||||
def downloader = new Downloader(eventBus, this, me, file, (long)json.length,
|
||||
|
||||
@@ -30,11 +30,11 @@ class ResultsParser {
|
||||
private static parseV1(Persona p, UUID uuid, def json) {
|
||||
if (json.name == null)
|
||||
throw new InvalidSearchResultException("name missing")
|
||||
if (json.size == null)
|
||||
if (json.size == null || json.size == 0)
|
||||
throw new InvalidSearchResultException("length missing")
|
||||
if (json.infohash == null)
|
||||
throw new InvalidSearchResultException("infohash missing")
|
||||
if (json.pieceSize == null)
|
||||
if (json.pieceSize == null || json.pieceSize == 0)
|
||||
throw new InvalidSearchResultException("pieceSize missing")
|
||||
if (!(json.hashList instanceof List))
|
||||
throw new InvalidSearchResultException("hashlist not a list")
|
||||
@@ -71,11 +71,11 @@ class ResultsParser {
|
||||
private static UIResultEvent parseV2(Persona p, UUID uuid, def json) {
|
||||
if (json.name == null)
|
||||
throw new InvalidSearchResultException("name missing")
|
||||
if (json.size == null)
|
||||
if (json.size == null || json.size == 0)
|
||||
throw new InvalidSearchResultException("length missing")
|
||||
if (json.infohash == null)
|
||||
throw new InvalidSearchResultException("infohash missing")
|
||||
if (json.pieceSize == null)
|
||||
if (json.pieceSize == null || json.pieceSize)
|
||||
throw new InvalidSearchResultException("pieceSize missing")
|
||||
if (json.hashList != null)
|
||||
throw new InvalidSearchResultException("V2 result with hashlist")
|
||||
|
||||
Reference in New Issue
Block a user