[jira] [Comment Edited] (TIKA-3063) Tika parser / POI crash with IndexOutOfBoundsException error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Comment Edited] (TIKA-3063) Tika parser / POI crash with IndexOutOfBoundsException error

Parth (Jira)

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

Junior Dussouillez edited comment on TIKA-3063 at 3/16/20, 3:43 PM:
--------------------------------------------------------------------

I finally found a file to reproduce the issue. The bug only happens with Tika v1.23 using the Maven dependency. It works fine using the tika JAR.

h1. Part 1 - Using the JAR

File to use :  [^test.doc]

Download the [tika-app-1.19.jar|https://archive.apache.org/dist/tika/tika-app-1.19.jar] and run :

{code:bash}
java -jar tika-app-1.19.jar -v -t test.doc
{code}

*It works fine*

If you use [tika-app-1.23.jar|https://archive.apache.org/dist/tika/tika-app-1.23.jar] it works too.

h1. Part 2 - Using the Maven dependency

First, unzip the Maven project [^tika-maven-dependency.zip].
_Note: the test file in included in the {{resources}} folder_

Then compile/run it using [tika 1.19|https://mvnrepository.com/artifact/org.apache.tika/tika/1.19] : *it works fine*.
{code:bash}
$ cd tika-maven-dependency
$ mvn clean package -Dtika.version=1.19 && java -jar target/tika-maven-dependency-1.0.0-SNAPSHOT-jar-with-dependencies.jar
$ # It works
{code}

Retry using [tika 1.23|https://mvnrepository.com/artifact/org.apache.tika/tika/1.23] : *error*
{code:bash}
$ mvn clean package -Dtika.version=1.23 && java -jar target/tika-maven-dependency-1.0.0-SNAPSHOT-jar-with-dependencies.jar
$ # TikaException
{code}

Stacktrace :
{code:none|collapse=true}
Exception in thread "main" org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.microsoft.OfficeParser@776b83cc
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:282)
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
        at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:143)
        at Main.main(Main.java:25)
Caused by: java.lang.IndexOutOfBoundsException: Block 32883 not found
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:429)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.readBAT(POIFSFileSystem.java:399)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.readCoreContents(POIFSFileSystem.java:373)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:232)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:170)
        at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:121)
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
        ... 3 more
Caused by: java.lang.IndexOutOfBoundsException: Position 16836608 past the end of the file
        at org.apache.poi.poifs.nio.FileBackedDataSource.read(FileBackedDataSource.java:84)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:427)
        ... 9 more
{code}



was (Author: jr1447):
I finally found a file to reproduce the issue. The bug only happens with Tika v1.23 using the Maven dependency. It works fine using the tika JAR.

h1. Part 1 - Using the JAR

*File to use :  [^test.doc]*

Download the [tika-app-1.19.jar|https://archive.apache.org/dist/tika/tika-app-1.19.jar] and run :

{code:bash}
java -jar tika-app-1.19.jar -v -t test.doc
{code}

*It works fine*

If you use [tika-app-1.23.jar|https://archive.apache.org/dist/tika/tika-app-1.23.jar] it works too.

h1. Part 2 - Using the Maven dependency

First, unzip the Maven project [^tika-maven-dependency.zip].
_Note: the test file in included in the {{resources}} folder_

Then compile/run it using [tika 1.19|https://mvnrepository.com/artifact/org.apache.tika/tika/1.19] : *it works fine*.
{code:bash}
$ cd tika-maven-dependency
$ mvn clean package -Dtika.version=1.19 && java -jar target/tika-maven-dependency-1.0.0-SNAPSHOT-jar-with-dependencies.jar
$ # It works
{code}

Retry using [tika 1.23|https://mvnrepository.com/artifact/org.apache.tika/tika/1.23] : *error*
{code:bash}
$ mvn clean package -Dtika.version=1.23 && java -jar target/tika-maven-dependency-1.0.0-SNAPSHOT-jar-with-dependencies.jar
$ # TikaException
{code}

Stacktrace :
{code:none|collapse=true}
Exception in thread "main" org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.microsoft.OfficeParser@776b83cc
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:282)
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
        at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:143)
        at Main.main(Main.java:25)
Caused by: java.lang.IndexOutOfBoundsException: Block 32883 not found
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:429)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.readBAT(POIFSFileSystem.java:399)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.readCoreContents(POIFSFileSystem.java:373)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:232)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:170)
        at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:121)
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
        ... 3 more
Caused by: java.lang.IndexOutOfBoundsException: Position 16836608 past the end of the file
        at org.apache.poi.poifs.nio.FileBackedDataSource.read(FileBackedDataSource.java:84)
        at org.apache.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:427)
        ... 9 more
{code}


> Tika parser / POI crash with IndexOutOfBoundsException error
> ------------------------------------------------------------
>
>                 Key: TIKA-3063
>                 URL: https://issues.apache.org/jira/browse/TIKA-3063
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.23
>         Environment: Windows 10 / java 1.8 /┬átika-app-1.23.jar
>            Reporter: MRIT64
>            Priority: Major
>             Fix For: 1.24
>
>         Attachments: test.doc, tika-maven-dependency.zip, tika_23_POI_issue.doc
>
>
> Exception duing parsing caused by an IndexOutOfBoundsException error in module poi.poifs.
> This was not happenig with tika 19, the previous version i used.
> A test file that causes the crash is attached.
> Regards
> Complete stack trace :
> Exception in thread "main" java.io.IOException:
>  at org.apache.tika.parser.ParsingReader.read(ParsingReader.java:277)
>  at java.io.Reader.read(Unknown Source)
>  at doxi.test.TikaFileParser.main(TikaFileParser.java:42)
>  Caused by: org.apache.tika.exception.TikaException: Unexpected RuntimeException from org.apache.tika.parser.microsoft.OfficeParser@5520942a
>  at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:282)
>  at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
>  at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:143)
>  at org.apache.tika.parser.ParsingReader$ParsingTask.run(ParsingReader.java:236)
>  at java.lang.Thread.run(Unknown Source)
>  Caused by: java.lang.IndexOutOfBoundsException: Block 40394 not found
>  at org.apache.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:429)
>  at org.apache.poi.poifs.filesystem.POIFSFileSystem.readBAT(POIFSFileSystem.java:399)
>  at org.apache.poi.poifs.filesystem.POIFSFileSystem.readCoreContents(POIFSFileSystem.java:373)
>  at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:232)
>  at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:170)
>  at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:121)
>  at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
>  ... 4 more
>  Caused by: java.lang.IndexOutOfBoundsException: Position 20682240 past the end of the file
>  at org.apache.poi.poifs.nio.FileBackedDataSource.read(FileBackedDataSource.java:84)
>  at org.apache.poi.poifs.filesystem.POIFSFileSystem.getBlockAt(POIFSFileSystem.java:427)
>  ... 10 more



--
This message was sent by Atlassian Jira
(v8.3.4#803005)