8278794: Infinite loop in DeflaterOutputStream.finish()

Reviewed-by: coffeys, lancea
This commit is contained in:
Ravi Reddy 2022-03-18 15:31:30 +00:00 committed by Lance Andersen
parent b2aa085e67
commit ff0b0927a2
5 changed files with 231 additions and 154 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -895,6 +895,16 @@ public class Deflater {
throw new NullPointerException("Deflater has been closed");
}
/**
* Returns the value of 'finish' flag.
* 'finish' will be set to true if def.finish() method is called.
*/
boolean shouldFinish() {
synchronized (zsRef) {
return finish;
}
}
private static native long init(int level, int strategy, boolean nowrap);
private static native void setDictionary(long addr, byte[] b, int off,
int len);