Bug 49579 - [PATCH]UnknowEscherRecord throws ArrayIndexOutOfBoundException
Summary: [PATCH]UnknowEscherRecord throws ArrayIndexOutOfBoundException
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.7-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2010-07-09 17:55 UTC by Zhang Zhang
Modified: 2010-07-27 11:26 UTC (History)
0 users

File that has this exception (155.00 KB, application/vnd.ms-powerpoint)
2010-07-09 17:57 UTC, Zhang Zhang
Test code (432 bytes, application/octet-stream)
2010-07-09 17:58 UTC, Zhang Zhang
Suggested patch (1.08 KB, patch)
2010-07-09 18:14 UTC, Zhang Zhang
Details | Diff
Patch for UnknowEscherRecord with Unit test case (3.36 KB, patch)
2010-07-16 18:08 UTC, Zhang Zhang
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zhang Zhang 2010-07-09 17:55:43 UTC
For some PPT files, UnknowEscherRecord throws ArrayIndexOutOfBoundException at line 62 at a System.arraycopy.
The bytesRemaining variable became really big for some files, so I guess it need a check to compare the bytesRemaining with the avaliabe bytes in data array.
Comment 1 Zhang Zhang 2010-07-09 17:57:15 UTC
Created attachment 25738 [details]
File that has this exception

This file has the ArrayOutOfBoundExceptioin, but it can be open by Office 2007 without problem.
Comment 2 Zhang Zhang 2010-07-09 17:58:15 UTC
Created attachment 25739 [details]
Test code

Test Java code to create a HSLFSlideShow instance and got the exception
Comment 3 Zhang Zhang 2010-07-09 18:14:20 UTC
Created attachment 25740 [details]
Suggested patch

Attached a suggest patch, if ok, I will open a new bug for check in.
Comment 4 Zhang Zhang 2010-07-16 18:08:44 UTC
Created attachment 25776 [details]
Patch for UnknowEscherRecord with Unit test case

Fix for the issue in UnknowEscherRecord with unit test cases.
Comment 5 Yegor Kozlov 2010-07-27 11:26:06 UTC
Applied in r979747