Skip to content

Commit

Permalink
Mark internal classes
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914408 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
centic9 committed Dec 6, 2023
1 parent c8c8130 commit fd9300d
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;

/**
Expand All @@ -34,6 +35,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
* The alert limits can be globally defined via {@link #setMaxEntrySize(long)}
* and {@link #setMinInflateRatio(double)}.
*/
@Internal
public class ZipSecureFile extends ZipFile {
private static final Logger LOG = LogManager.getLogger(ZipSecureFile.class);
/* package */ static double MIN_INFLATE_RATIO = 0.01d;
Expand All @@ -60,21 +62,21 @@ public class ZipSecureFile extends ZipFile {
/**
* Sets the ratio between de- and inflated bytes to detect zipbomb.
* It defaults to 1% (= 0.01d), i.e. when the compression is better than
* 1% for any given read package part, the parsing will fail indicating a
* 1% for any given read package part, the parsing will fail indicating a
* Zip-Bomb.
*
* @param ratio the ratio between de- and inflated bytes to detect zipbomb
*/
public static void setMinInflateRatio(double ratio) {
MIN_INFLATE_RATIO = ratio;
}

/**
* Returns the current minimum compression rate that is used.
*
*
* See setMinInflateRatio() for details.
*
* @return The min accepted compression-ratio.
* @return The min accepted compression-ratio.
*/
public static double getMinInflateRatio() {
return MIN_INFLATE_RATIO;
Expand Down Expand Up @@ -106,8 +108,8 @@ public static void setMaxFileCount(final long maxFileCount) {
/**
* Sets the maximum file size of a single zip entry. It defaults to 4GB,
* i.e. the 32-bit zip format maximum.
*
* This can be used to limit memory consumption and protect against
*
* This can be used to limit memory consumption and protect against
* security vulnerabilities when documents are provided by users.
*
* @param maxEntrySize the max. file size of a single zip entry
Expand All @@ -124,10 +126,10 @@ public static void setMaxEntrySize(long maxEntrySize) {

/**
* Returns the current maximum allowed uncompressed file size.
*
*
* See setMaxEntrySize() for details.
*
* @return The max accepted uncompressed file size.
* @return The max accepted uncompressed file size.
*/
public static long getMaxEntrySize() {
return MAX_ENTRY_SIZE;
Expand Down Expand Up @@ -170,8 +172,8 @@ public static long getGraceEntrySize() {
* Sets the maximum number of characters of text that are
* extracted before an exception is thrown during extracting
* text from documents.
*
* This can be used to limit memory consumption and protect against
*
* This can be used to limit memory consumption and protect against
* security vulnerabilities when documents are provided by users.
*
* @param maxTextSize the max. file size of a single zip entry
Expand All @@ -188,7 +190,7 @@ public static void setMaxTextSize(long maxTextSize) {

/**
* Returns the current maximum allowed text size.
*
*
* @return The max accepted text size.
* @see #setMaxTextSize(long)
*/
Expand Down

0 comments on commit fd9300d

Please sign in to comment.