From dd400bb14b8eff28754045de5bb30be59ea0cee2 Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 22 Dec 2016 14:13:39 +0000 Subject: [PATCH] Update: Fix JVM crash and i2p.jar corruption when updating from -1 --- core/java/src/net/i2p/util/FileUtil.java | 12 +++++++++++- history.txt | 18 ++++++++++++++++++ .../java/src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/util/FileUtil.java b/core/java/src/net/i2p/util/FileUtil.java index c72e93de5f..47aba6030d 100644 --- a/core/java/src/net/i2p/util/FileUtil.java +++ b/core/java/src/net/i2p/util/FileUtil.java @@ -98,6 +98,9 @@ public class FileUtil { } /** + * Warning - do not call any new classes from here, or + * update will crash the JVM. + * * @param logLevel Log.WARN, etc. * @return true if it was copied successfully * @since 0.9.7 @@ -106,6 +109,7 @@ public class FileUtil { int files = 0; ZipFile zip = null; try { + final byte buf[] = new byte[8192]; zip = new ZipFile(zipfile); Enumeration entries = zip.entries(); while (entries.hasMoreElements()) { @@ -153,7 +157,13 @@ public class FileUtil { System.err.println("INFO: File [" + entry.getName() + "] extracted and unpacked"); } else { fos = new FileOutputStream(target); - DataHelper.copy(in, fos); + // We do NOT use DataHelper.copy() because it loads new classes + // and causes the update to crash. + //DataHelper.copy(in, fos); + int read; + while ((read = in.read(buf)) != -1) { + fos.write(buf, 0, read); + } if (logLevel <= Log.INFO) System.err.println("INFO: File [" + entry.getName() + "] extracted"); } diff --git a/history.txt b/history.txt index c90de51e31..75de889154 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,21 @@ +2016-12-22 zzz + * Blocklist: + - More efficiently check blocklist when receiving new RI + - Check blocklist when loading RIs + - Ensure blocklist is initialized before netdb + * Console: Limit age of news entries displayed + * Update: Fix JVM crash and i2p.jar corruption when updating from -1 + +2016-12-21 zzz + * NTP: + - Verify source address and port + - Add to command line + - Add KoD support (ticket #1896) + - Add initial IPv6 support (ticket #1897) + +2016-12-20 zzz + * Build: Fix installer compile failure + 2016-12-16 zzz * Router: Synchronize graceful exit code access * Update: Save blocklist version in UpdateManager diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 87e5bffca0..282c18b422 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 = 1; + public final static long BUILD = 2; /** for example "-test" */ public final static String EXTRA = "";