Router: Prevent double-free of SHA256 instances from Noise

This commit is contained in:
zzz
2025-03-22 14:48:01 -04:00
parent b27c8d0f97
commit 0d5108de1d
3 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,15 @@
2025-03-22 zzz
* Router: Prevent double-free of SHA256 instances from Noise
2025-03-21 zzz
* Build: Add cs man pages, cs, pt_BR, zh_TW eepsite help pages
2025-03-19 zzz
* Build: Remove more files from Debian source tarball
* Console: Reduce memory usage in BanlistRenderer
* i2psnark: Use torrent name instead of torrent file name in notifications
* i2ptunnel: Version the proxy CSS in more places
2025-03-17 2.8.1 (API 0.9.65) released
2025-03-14 zzz

View File

@ -101,6 +101,7 @@ class SymmetricState implements Destroyable, Cloneable {
private final byte[] ck;
private final byte[] h;
private final byte[] prev_h;
private boolean isDestroyed;
/**
* Constructs a new symmetric state object.
@ -402,7 +403,13 @@ class SymmetricState implements Destroyable, Cloneable {
}
@Override
public void destroy() {
public synchronized void destroy() {
if (isDestroyed) {
// prevent double-free of hash
//(new Exception("Already destroyed")).printStackTrace();
return;
}
isDestroyed = true;
cipher.destroy();
hash.reset();
Noise.releaseHash(hash);

View File

@ -19,8 +19,8 @@ public class RouterVersion {
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
/** for example: "beta", "alpha", "rc" */
public final static String QUALIFIER = "";
public final static long BUILD = 0;
public final static String QUALIFIER = "-rc";
public final static long BUILD = 1;
/** for example "-test" */
public final static String EXTRA = "";
public final static String FULL_VERSION = VERSION + "-" + BUILD + QUALIFIER + EXTRA;