[ 
https://issues.apache.org/jira/browse/TIKA-3644?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17474598#comment-17474598
 ] 

Sergen Bağ commented on TIKA-3644:
----------------------------------

Hi [~tallison], I set 5 to MaximumPackageEntryDepth. My expectation is Tika 
throws this exception in all cases. I don't know what I missed.  
!tika_exception.PNG!

I am using this code:

+_TikaExtractor.java_+
{code:java}
    static AutoDetectParser parser = new AutoDetectParser();
     
    public ContentMetadata ExtractContentAndMetadata(InputStream inputStream, 
ExtractionParameters params) throws IOException, SAXException, TikaException
    {
        BodyContentHandler handler = new BodyContentHandler(-1);    
        
        Metadata metadata = new Metadata();        
        ContentMetadata result  = new ContentMetadata();
                       
        AutoDetectParserConfig autoDetectParserConfig = new 
AutoDetectParserConfig(null, 1000000L, 100L, 100, 5);
        parser.setAutoDetectParserConfig(autoDetectParserConfig);
        
        ParseContext context = new ParseContext();
                                 
        try (InputStream stream = inputStream) 
        {
            parser.parse(stream, handler, metadata, context);
            
            result.setContent(handler.toString());            
            result.setMetadata(metadata.toString());            
        }
        
        return result;
    }
{code}
+_pom.xml_+ 
{code:java}
    <dependency>
         <groupId>org.apache.tika</groupId>
         <artifactId>tika-core</artifactId>
        <version>2.2.1</version>
    </dependency>    
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-parsers-standard-package</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-parser-sqlite3-package</artifactId>
        <version>2.2.1</version>
     </dependency>
     <dependency>
        <groupId>org.apache.tika</groupId>
        <artifactId>tika-parser-scientific-package</artifactId>
        <version>2.2.1</version>
     </dependency> {code}

> OfficeParser can not detect embedded zip bomb in the office documents
> ---------------------------------------------------------------------
>
>                 Key: TIKA-3644
>                 URL: https://issues.apache.org/jira/browse/TIKA-3644
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 2.2.1
>            Reporter: Sergen Bağ
>            Priority: Minor
>         Attachments: 10_2_2_2_2.zip, tika_exception.PNG, zipbomb.doc, 
> zipbomb.docx, zipbomb.ppt, zipbomb.pptx, zipbomb.xls, zipbomb.xlsx
>
>
> Hi, I am trying to get "zip bomb detection" exception but I can't. I used 
> attachments as below and I saw this situation like that:
> When I send "zipbomb.xls" and "zipbomb.doc" to Tika, Tika threw exception.
> When I send "zipbomb.xlsx","zipbomb.docx","zipbomb.ppt" and "zipbomb.pptx" to 
> Tika, Tika didn't throw exception.
> Thanks.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to