tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Seegler Ittyavirah (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TIKA-788) DWG parser infinite loop on possibly corrupt file
Date Wed, 02 Oct 2013 14:48:43 GMT

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

Seegler Ittyavirah commented on TIKA-788:
-----------------------------------------

Here is another instance. Not sure this is related to the issue reported

pool-1-thread-1" prio=10 tid=0x00007f07e03c1000 nid=0x1cec runnable [0x00007f07c9b64000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:242)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        - locked <0x00000000e63e24d0> (a java.io.BufferedInputStream)
        at org.apache.tika.io.ProxyInputStream.read(ProxyInputStream.java:99)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at org.apache.tika.io.TailStream.read(TailStream.java:117)
        at org.apache.tika.io.TailStream.skip(TailStream.java:140)
        at org.apache.tika.parser.mp3.MpegStream.skipStream(MpegStream.java:283)
        at org.apache.tika.parser.mp3.MpegStream.skipFrame(MpegStream.java:160)
        at org.apache.tika.parser.mp3.Mp3Parser.getAllTagHandlers(Mp3Parser.java:193)
        at org.apache.tika.parser.mp3.Mp3Parser.parse(Mp3Parser.java:71)
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
        at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
        at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
        at org.apache.tika.parser.ParserDecorator.parse(ParserDecorator.java:91)

> DWG parser infinite loop on possibly corrupt file
> -------------------------------------------------
>
>                 Key: TIKA-788
>                 URL: https://issues.apache.org/jira/browse/TIKA-788
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.0
>            Reporter: Stas Shaposhnikov
>
> When parsing some dwg items, it is possible that the parser may cause itself to go into
an infinite loop.
> Attached is the file causing the problem.
> Here is a possible patch that will at least proceed until an error is thrown.
> {noformat}
> === modified file 'tika-parsers/src/main/java/org/apache/tika/parser/dwg/DWGParser.java'
> --- tika-parsers/src/main/java/org/apache/tika/parser/dwg/DWGParser.java        2011-11-24
11:30:33 +0000
> +++ tika-parsers/src/main/java/org/apache/tika/parser/dwg/DWGParser.java        2011-11-25
05:27:41 +0000
> @@ -274,8 +274,10 @@
>              return false;
>          }
>          while (toSkip > 0) {
> -            byte[] skip = new byte[Math.min((int) toSkip, 0x4000)];
> -            IOUtils.readFully(stream, skip);
> +            byte[] skip = new byte[(int) Math.min(toSkip, 0x4000)];
> +            if (IOUtils.readFully(stream, skip) == -1) {
> +               return false; //invalid skip
> +            }
>              toSkip -= skip.length;
>          }
>          return true;
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message