forked from I2P_Developers/i2p.i2p
* i2psnark: Fix decoding of negative numbers (ticket #1307)
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
package org.klomp.snark.bencode;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
@ -232,10 +233,8 @@ public class BDecoder
|
||||
|
||||
if (c == '-')
|
||||
{
|
||||
c = read();
|
||||
if (c == '0')
|
||||
throw new InvalidBEncodingException("Negative zero not allowed");
|
||||
chars.append((char)c);
|
||||
c = read();
|
||||
}
|
||||
|
||||
if (c < '1' || c > '9')
|
||||
@ -376,4 +375,21 @@ public class BDecoder
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* prints out the decoded data
|
||||
* @since 0.9.14
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("Usage: BDecoder file.torrent");
|
||||
System.exit(1);
|
||||
}
|
||||
try {
|
||||
BEValue bev = bdecode(new FileInputStream(args[0]));
|
||||
System.out.println(bev.toString());
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2014-06-10 zzz
|
||||
* i2psnark: Fix decoding of negative numbers (ticket #1307)
|
||||
* NewsFetcher: Only treat correct status codes as success
|
||||
|
||||
2014-06-09 zzz
|
||||
* i2psnark:
|
||||
- Show client version if available
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 5;
|
||||
public final static long BUILD = 6;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user