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;
|
package org.klomp.snark.bencode;
|
||||||
|
|
||||||
import java.io.EOFException;
|
import java.io.EOFException;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@ -232,10 +233,8 @@ public class BDecoder
|
|||||||
|
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
{
|
{
|
||||||
c = read();
|
|
||||||
if (c == '0')
|
|
||||||
throw new InvalidBEncodingException("Negative zero not allowed");
|
|
||||||
chars.append((char)c);
|
chars.append((char)c);
|
||||||
|
c = read();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c < '1' || c > '9')
|
if (c < '1' || c > '9')
|
||||||
@ -376,4 +375,21 @@ public class BDecoder
|
|||||||
return result;
|
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
|
2014-06-09 zzz
|
||||||
* i2psnark:
|
* i2psnark:
|
||||||
- Show client version if available
|
- Show client version if available
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 5;
|
public final static long BUILD = 6;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user