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

Tim Allison commented on TIKA-2428:
-----------------------------------

bq. I don't think the javadocs allow that. 

I think the javadocs warn about this for FileInputStream with the following, 
but I think the implementation is, um, less than ideal and in conflict with the 
behavior we'd expect from the javadocs for InputStream.

bq. number of bytes skipped may include some number of bytes that were beyond 
the EOF of the backing file

This test passes for me:
{noformat}
    @Test
    public void testFalseAllegationFromFileInputStream() throws IOException {
        File tmp = File.createTempFile("poi", "");
        FileOutputStream fos = new FileOutputStream(tmp);
        for (int i = 0; i < 10000; i++) {
            fos.write(2);
        }
        fos.flush();
        fos.close();
        assertEquals(10000, tmp.length());

        InputStream is = new FileInputStream(tmp);
        assertEquals(20000, is.skip(20000));
        is.close();
        tmp.delete();
    }
{noformat}

> EMFParser loops forever with corrupted files
> --------------------------------------------
>
>                 Key: TIKA-2428
>                 URL: https://issues.apache.org/jira/browse/TIKA-2428
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.15, 1.16
>            Reporter: Luis Filipe Nassif
>         Attachments: Carved-1285676.emf, Carved-1296288.emf, Carved-912866.emf
>
>
> EMFParser hangs with the attached corrupted EMF files.
> Sorry [~talli...@apache.org]! Just now having time to test against our 
> forensic test corpus...



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to