You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2018/03/08 19:57:00 UTC

[tika] branch branch_1x updated: TIKA-2591 -- prevent AIOOBE when haystack shorter than needle

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch branch_1x
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/branch_1x by this push:
     new 4d75a32  TIKA-2591 -- prevent AIOOBE when haystack shorter than needle
4d75a32 is described below

commit 4d75a32c8e98e333b6142c3a38ec57c4f00bd78a
Author: tballison <ta...@mitre.org>
AuthorDate: Thu Mar 8 14:56:12 2018 -0500

    TIKA-2591 -- prevent AIOOBE when haystack shorter than needle
---
 .../src/main/java/org/apache/tika/parser/pkg/ZipContainerDetector.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tika-parsers/src/main/java/org/apache/tika/parser/pkg/ZipContainerDetector.java b/tika-parsers/src/main/java/org/apache/tika/parser/pkg/ZipContainerDetector.java
index c453617..3d12eba 100644
--- a/tika-parsers/src/main/java/org/apache/tika/parser/pkg/ZipContainerDetector.java
+++ b/tika-parsers/src/main/java/org/apache/tika/parser/pkg/ZipContainerDetector.java
@@ -139,6 +139,9 @@ public class ZipContainerDetector implements Detector {
     }
 
     private static boolean arrayStartWith(byte[] needle, byte[] haystack) {
+        if (haystack.length < needle.length) {
+            return false;
+        }
         for (int i = 0; i < needle.length; i++) {
             if (haystack[i] != needle[i]) {
                 return false;

-- 
To stop receiving notification emails like this one, please contact
tallison@apache.org.