Skip to content

Commit

Permalink
TIKA-3336 -- new zip bombs detect in 1.26-SNAPSHOT compared with 1.25…
Browse files Browse the repository at this point in the history
… -- bug, don't advance twice per call to chars/whitespace
  • Loading branch information
tballison committed Mar 23, 2021
1 parent b1e8641 commit 2b8c9a3
Showing 1 changed file with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,10 @@ public void endElement(String uri, String localName, String name) throws SAXExce
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
if (totalWriteLimit < 0) {
advance(length);
super.characters(ch, start, length);
return;
}
int availableLength = Math.min(totalWriteLimit - totalChars, length);
advance(availableLength);
super.characters(ch, start, availableLength);
if (availableLength < length) {
throw new WriteLimitReached();
Expand All @@ -503,12 +501,10 @@ public void characters(char[] ch, int start, int length) throws SAXException {
@Override
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
if (totalWriteLimit < 0) {
advance(length);
super.ignorableWhitespace(ch, start, length);
return;
}
int availableLength = Math.min(totalWriteLimit - totalChars, length);
advance(availableLength);
super.ignorableWhitespace(ch, start, availableLength);
if (availableLength < length) {
throw new WriteLimitReached();
Expand Down

0 comments on commit 2b8c9a3

Please sign in to comment.