Bug 56911 - PlfLfo.add(LFO, LFOData) results in IOOBE
Summary: PlfLfo.add(LFO, LFOData) results in IOOBE
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.11-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-09-04 09:23 UTC by Yaniv Kunda
Modified: 2016-04-06 09:02 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Yaniv Kunda 2014-09-04 09:23:10 UTC
The following code in the method will always result in a IOOBE:

_rgLfo[_lfoMac + 1] = lfo;
_rgLfoData[_lfoMac + 1] = lfoData;

should be:

_rgLfo[_lfoMac] = lfo;
_rgLfoData[_lfoMac] = lfoData;

Sadly, this code is only reachable from the external org.apache.poi.hwpf.HWPFDocument#registerList(HWPFList) method, and has no tests.
Furthermore, org.apache.poi.hwpf.model.TestListTables has a single test which does nothing - it uses a fixture that causes the first "if" to essentially skip the test.

I am not familiar with this object model, so I cannot provide a sensible test.
Comment 1 Dominik Stadler 2016-04-05 15:30:58 UTC
I cannot see the problem with the code, it first enlarges the array and then puts the element into the postion that was just newly created, so should not cause any Exception.

Please reopen if you can provide a unit-test that shows how it causes an Exception here.
Comment 2 Dominik Stadler 2016-04-05 15:32:34 UTC
Oops, sorry, I was wrong, seems to be really broken, but not used anywhere at all.
Comment 3 Dominik Stadler 2016-04-06 09:02:49 UTC
Fixed via r1737947 for 3.15-beta2, seems only very few people use this as it can never have worked before.