Bug 63812

Summary: WMF should throw more informative exception on corrupt WMF
Product: POI Reporter: Tim Allison <tallison>
Component: POI OverallAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Example triggering file

Description Tim Allison 2019-10-07 14:05:11 UTC
I'm getting a bunch more ArrayIndexOutOfBoundsExceptions in the regression tests of emf/wmf with specifically wmf files.

This line in HwmfHeader assumes that leis.readUShort()-1 assumes that the short-1 will be in the correct range.

this.type = HwmfHeader.HwmfHeaderMetaType.values()[leis.readUShort() - 1];

We should add a bounds check and throw a more informative exception.
Comment 1 Tim Allison 2019-10-21 15:18:47 UTC
Created attachment 36850 [details]
Example triggering file

I need to do some more digging to figure out why this file is being identified as WMF from the parent parser.