diff --git a/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java b/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
index fb899bcbd..bf6059d43 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java
@@ -893,11 +893,16 @@ public class TrackerClient implements Runnable {
} catch (URISyntaxException use) {
return false;
}
+ String path = url.getPath();
+ if (path == null || !path.startsWith("/"))
+ return false;
return "http".equals(url.getScheme()) && url.getHost() != null &&
(url.getHost().endsWith(".i2p") || url.getHost().equals("i2p"));
}
/**
+ * This also validates the URL.
+ *
* @param ann an announce URL non-null
* @return a Hash for i2p hosts only, null otherwise
* @since 0.9.5
@@ -914,8 +919,12 @@ public class TrackerClient implements Runnable {
String host = url.getHost();
if (host == null)
return null;
- if (host.endsWith(".i2p"))
+ if (host.endsWith(".i2p")) {
+ String path = url.getPath();
+ if (path == null || !path.startsWith("/"))
+ return null;
return ConvertToHash.getHash(host);
+ }
if (host.equals("i2p")) {
String path = url.getPath();
if (path == null || path.length() < 517 ||
@@ -941,6 +950,10 @@ public class TrackerClient implements Runnable {
int consecutiveFails;
int seenPeers;
+ /**
+ * @param a must be a valid http URL with a path
+ * @param p true if primary
+ */
public TCTracker(String a, boolean p)
{
announce = a;
diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
index 4325d3acf..09c4699bd 100644
--- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
+++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
@@ -1085,8 +1085,9 @@ public class I2PSnarkServlet extends BasicServlet {
// should be only one
if (df.delete())
_manager.addMessage(_t("Data file deleted: {0}", df.getAbsolutePath()));
- else
+ else if (df.exists())
_manager.addMessage(_t("Data file could not be deleted: {0}", df.getAbsolutePath()));
+ // else already gone
}
break;
}
@@ -1094,8 +1095,9 @@ public class I2PSnarkServlet extends BasicServlet {
for (File df : storage.getFiles()) {
if (df.delete()) {
//_manager.addMessage(_t("Data file deleted: {0}", df.getAbsolutePath()));
- } else {
+ } else if (df.exists()) {
_manager.addMessage(_t("Data file could not be deleted: {0}", df.getAbsolutePath()));
+ // else already gone
}
}
// step 2 delete dirs bottom-up
@@ -1109,11 +1111,12 @@ public class I2PSnarkServlet extends BasicServlet {
if (df.delete()) {
ok = true;
//_manager.addMessage(_t("Data dir deleted: {0}", df.getAbsolutePath()));
- } else {
+ } else if (df.exists()) {
ok = false;
_manager.addMessage(_t("Directory could not be deleted: {0}", df.getAbsolutePath()));
if (_log.shouldLog(Log.WARN))
_log.warn("Could not delete dir " + df);
+ // else already gone
}
}
// step 3 message for base (last one)
diff --git a/apps/streaming/java/src/net/i2p/client/streaming/impl/Packet.java b/apps/streaming/java/src/net/i2p/client/streaming/impl/Packet.java
index a887dc3d2..483a8d4ee 100644
--- a/apps/streaming/java/src/net/i2p/client/streaming/impl/Packet.java
+++ b/apps/streaming/java/src/net/i2p/client/streaming/impl/Packet.java
@@ -780,7 +780,12 @@ class Packet {
if (isFlagSet(FLAG_MAX_PACKET_SIZE_INCLUDED)) buf.append(" MS ").append(_optionMaxSize);
if (isFlagSet(FLAG_PROFILE_INTERACTIVE)) buf.append(" INTERACTIVE");
if (isFlagSet(FLAG_RESET)) buf.append(" RESET");
- if (isFlagSet(FLAG_SIGNATURE_INCLUDED)) buf.append(" SIG ").append(_optionSignature.length());
+ if (isFlagSet(FLAG_SIGNATURE_INCLUDED)) {
+ if (_optionSignature != null)
+ buf.append(" SIG ").append(_optionSignature.length());
+ else
+ buf.append(" (to be signed)");
+ }
if (isFlagSet(FLAG_SIGNATURE_REQUESTED)) buf.append(" SIGREQ");
if (isFlagSet(FLAG_SYNCHRONIZE)) buf.append(" SYN");
}
diff --git a/build.xml b/build.xml
index 90e8a1fac..847629bb2 100644
--- a/build.xml
+++ b/build.xml
@@ -1400,6 +1400,7 @@
+
@@ -1413,6 +1414,7 @@
+
@@ -1915,8 +1917,9 @@
+-->
+
diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java
index 10b5fb777..b867cf76f 100644
--- a/core/java/src/net/i2p/util/NativeBigInteger.java
+++ b/core/java/src/net/i2p/util/NativeBigInteger.java
@@ -640,7 +640,9 @@ public class NativeBigInteger extends BigInteger {
}
/**
- * @throws ArithmeticException if m <= 0
+ * @param m must be postive
+ * @param exponent must be postive
+ * @throws ArithmeticException if m <= 0 or exponent <=0
*/
@Override
public BigInteger modPow(BigInteger exponent, BigInteger m) {
@@ -654,7 +656,9 @@ public class NativeBigInteger extends BigInteger {
}
/**
- * @throws ArithmeticException if m <= 0
+ * @param exponent must be postive
+ * @param m must be postive and odd
+ * @throws ArithmeticException if m <= 0 or m is even or exponent <=0
* @since 0.9.26 and libjbigi version 3 and GMP version 5
*/
public BigInteger modPowCT(BigInteger exponent, BigInteger m) {
diff --git a/history.txt b/history.txt
index 36abe5129..77602ec9e 100644
--- a/history.txt
+++ b/history.txt
@@ -1,3 +1,8 @@
+2016-08-02 zzz
+ * i2psnark: Fix SIOOBE on bad announce URL (ticket #1823)
+ * SSU: Fix peer test stuck when IPv6-only (ticket #1819)
+ * Streaming: Fix debug NPE (ticket #1821)
+
2016-07-20 zzz
* SSU:
- Increase minimum peers if we have a IPv6 address
diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java
index fecba78d6..a6204817e 100644
--- a/router/java/src/net/i2p/router/RouterVersion.java
+++ b/router/java/src/net/i2p/router/RouterVersion.java
@@ -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 = 7;
+ public final static long BUILD = 8;
/** for example "-test" */
public final static String EXTRA = "";
diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java
index 7b94b14d7..dfd96266b 100644
--- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java
+++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java
@@ -3303,7 +3303,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
locked_runTest(false);
} else if (_haveIPv6Address &&_forceRun == FORCE_IPV6 && sinceRunV6 >= MIN_TEST_FREQUENCY) {
locked_runTest(true);
- } else if (sinceRunV4 >= TEST_FREQUENCY) {
+ } else if (sinceRunV4 >= TEST_FREQUENCY && getIPv6Config() != IPV6_ONLY) {
locked_runTest(false);
} else if (_haveIPv6Address && sinceRunV6 >= TEST_FREQUENCY) {
locked_runTest(true);
@@ -3316,7 +3316,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (_alive) {
long delay = (TEST_FREQUENCY / 2) + _context.random().nextInt(TEST_FREQUENCY);
// if we have 2 addresses, give IPv6 a chance also
- if (_haveIPv6Address)
+ if (_haveIPv6Address && getIPv6Config() != IPV6_ONLY)
delay /= 2;
schedule(delay);
}