8277087: ZipException: zip END header not found at ZipFile#Source.findEND

Reviewed-by: lancea
This commit is contained in:
Sergey Bylokhov 2021-11-23 08:57:34 +00:00
parent 12f08ba4d4
commit e3243ee963
2 changed files with 117 additions and 3 deletions

View file

@ -144,11 +144,14 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
* ZIP file comment is greater than 0xFFFF bytes
*/
public void setComment(String comment) {
byte[] bytes = null;
if (comment != null) {
this.comment = zc.getBytes(comment);
if (this.comment.length > 0xffff)
throw new IllegalArgumentException("ZIP file comment too long.");
bytes = zc.getBytes(comment);
if (bytes.length > 0xffff) {
throw new IllegalArgumentException("ZIP file comment too long");
}
}
this.comment = bytes;
}
/**