I'm getting the following exception when reading a .doc file: java.lang.NullPointerException: Cannot read the array length because "<parameter1>" is null at java.base/java.lang.String.<init>(Unknown Source) at org.apache.poi.poifs.macros.VBAMacroReader$ModuleImpl.getContent(VBAMacroReader.java:175) at org.apache.poi.poifs.macros.VBAMacroReader.readMacros(VBAMacroReader.java:160) I believe the code of module.read(in) here: https://github.com/apache/poi/blob/REL_5_2_2/poi/src/main/java/org/apache/poi/poifs/macros/VBAMacroReader.java#L232 may fix the issue. I tried it in the debugger, and it seemed to resolve the NPE. Thanks for your time and great work, Greg
Any chance you can share a triggering file? Even if privately? I feel like we should have heard about more NPEs from the community or our regression corpora if we were supposed to module.read(in) at that point. Have you tried using a more recent version of POI?
>I feel like we should have heard about more NPEs from the community or our regression corpora if we were supposed to module.read(in) at that point. That said, I trust your finding and would like to dig in. Thank you!
Created attachment 39377 [details] problem file
Hi Tim, I think I misunderstood the attachment mechanism, but it should be that file above. I would recommend not opening in word because it may contain malicious macros. Unfortunately, I tried this out in 5.2.4 as well with no luck. Thanks for your help, Greg