https://bz.apache.org/bugzilla/show_bug.cgi?id=59830

            Bug ID: 59830
           Summary: "Skipped only -1 while trying to skip 67116544 bytes.
                    This should never happen." IOException in
                    VBAMacroReader
           Product: POI
           Version: 3.15-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POIFS
          Assignee: dev@poi.apache.org
          Reporter: bro...@usinternet.com

Created attachment 34027
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34027&action=edit
Example doc that causes readMacros() to throw an IOException

WARNING: ATTACHED DOCUMENT IS INFECTED WITH A MALICIOUS MACRO. DO NOT OPEN IT
USING MICROSOFT WORD.

I have been using POI to help take apart Office documents and look for
suspicious/malicious content. I had developed my own way to extract the VBA
script in the embedded macros, but have found the new VBAMacroReader to be much
more useful.

However, I have noticed that VBAMacroReader fails on certain Office documents.
I have attached one such example.


Code used to reproduce the error:

File file = new File("macro_virus.doc");
VBAMacroReader reader = new VBAMacroReader(file);
Map<String, String> macros = reader.readMacros();


Stack trace:
java.io.IOException: Skipped only -1 while trying to skip 67116544 bytes.  This
should never happen.
    at
org.apache.poi.poifs.macros.VBAMacroReader.trySkip(VBAMacroReader.java:182)
    at
org.apache.poi.poifs.macros.VBAMacroReader.readMacros(VBAMacroReader.java:240)
    at
org.apache.poi.poifs.macros.VBAMacroReader.findMacros(VBAMacroReader.java:148)
    at
org.apache.poi.poifs.macros.VBAMacroReader.findMacros(VBAMacroReader.java:153)
    at
org.apache.poi.poifs.macros.VBAMacroReader.findMacros(VBAMacroReader.java:153)
    at
org.apache.poi.poifs.macros.VBAMacroReader.readMacros(VBAMacroReader.java:115)
    at poitester.POITester.main(POITester.java:27)


I've successfully opened the file in a sandbox and it appears to be a valid
Word document.

Also, just FYI, I am using poi-3.15-beta2 and I get the same results on OSX
10.10.5 and openSUSE 11.4. 

Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to