Bug 56138 - Index out of range exception in CodePageString
Summary: Index out of range exception in CodePageString
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HPSF (show other bugs)
Version: 3.10-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-14 13:03 UTC by Jon Iles
Modified: 2014-02-16 19:40 UTC (History)
0 users



Attachments
Test case to reproduce the problem (13.75 KB, application/x-zip-compressed)
2014-02-14 13:03 UTC, Jon Iles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Iles 2014-02-14 13:03:47 UTC
Created attachment 31313 [details]
Test case to reproduce the problem

An index out of range exception is thrown in CodePageString when reading a PropertySet from a Microsoft Project MPP file.

I have attached a test case which reproduces the issue. The fix for the issue is to change line 45 of CodePageString.java to add a test for zero length strings:

Before:
if ( _value[size - 1] != 0 ) {

After:
if ( size != 0 && _value[size - 1] != 0 ) {
Comment 1 Nick Burch 2014-02-16 19:40:15 UTC
Thanks for this! I've applied your patch, along with a slightly altered version of the unit test in r1568813.