BUG 60158 -- AIOOBE in VBAMacroReader

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tim Allison 2016-10-18 12:55:34 +00:00
parent bf95861693
commit db79501e9f
3 changed files with 10 additions and 10 deletions

View File

@ -265,6 +265,9 @@ public class VBAMacroReader implements Closeable {
private static final int MODULETYPE_PROCEDURAL = 0x0021; private static final int MODULETYPE_PROCEDURAL = 0x0021;
private static final int MODULETYPE_DOCUMENT_CLASS_OR_DESIGNER = 0x0022; private static final int MODULETYPE_DOCUMENT_CLASS_OR_DESIGNER = 0x0022;
private static final int PROJECTLCID = 0x0002; private static final int PROJECTLCID = 0x0002;
private static final int MODULE_NAME = 0x0019;
private static final int MODULE_NAME_UNICODE = 0x0047;
private static final int MODULE_DOC_STRING = 0x001c;
/** /**
* Reads VBA Project modules from a VBA Project directory located at * Reads VBA Project modules from a VBA Project directory located at

View File

@ -91,7 +91,7 @@ public class RLEDecompressingInputStream extends InputStream {
return -1; return -1;
} }
} }
return buf[pos++]; return buf[pos++]& 0xFF;
} }
@Override @Override

View File

@ -280,16 +280,13 @@ public class TestVBAMacroReader {
} }
} }
} }
// This test is written as expected-to-fail and should be rewritten
// as expected-to-pass when the bug is fixed.
@Test @Test
public void bug60158() throws IOException { public void bug60158() throws IOException {
try { File f = POIDataSamples.getDocumentInstance().getFile("60158.docm");
fromFile(POIDataSamples.getDocumentInstance(), "60158.docm"); VBAMacroReader r = new VBAMacroReader(f);
testPassesNow(60158); Map<String, String> macros = r.readMacros();
} catch (ArrayIndexOutOfBoundsException e) { assertNotNull(macros.get("NewMacros"));
skipTest(e); assertContains(macros.get("NewMacros"), "' dirty");
}
} }
} }