protected void advance(int length) throws SAXException {
        characterCount += length;
        long byteCount = getByteCount();
        if (characterCount > threshold && characterCount > byteCount * ratio) {
            throw new SecureSAXException(
                    "Suspected zip bomb: " + byteCount + " input bytes produced " + characterCount +
                            " output characters");
        }
    }
Records the given number of output characters (or more accurately
UTF-16 code units). Throws an exception if the recorded number of
characters highly exceeds the number of input bytes read.

@param length number of new output characters produced
@throws SAXException if a zip bomb is detected
tika-core/src/main/java/org/apache/tika/sax/SecureContentHandler.java