Bug 63812 - WMF should throw more informative exception on corrupt WMF
Summary: WMF should throw more informative exception on corrupt WMF
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: unspecified
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2019-10-07 14:05 UTC by Tim Allison
Modified: 2021-10-13 20:41 UTC (History)
0 users

Example triggering file (5.36 KB, image/wmf)
2019-10-21 15:18 UTC, Tim Allison

Note You need to log in before you can comment on or make changes to this bug.
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.