Bug 54634 - [PATCH] End index for bookmarks are incorrect when bookmarks overlap
Summary: [PATCH] End index for bookmarks are incorrect when bookmarks overlap
Status: RESOLVED LATER
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.9-FINAL
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2013-03-04 23:29 UTC by Josh Holthaus
Modified: 2019-03-10 16:21 UTC (History)
0 users



Attachments
patch file and a sample document for the test cases (6.25 KB, application/zip)
2013-03-04 23:29 UTC, Josh Holthaus
Details
patch file and a sample document for the test cases (6.23 KB, application/zip)
2013-03-05 05:29 UTC, Josh Holthaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Holthaus 2013-03-04 23:29:07 UTC
Created attachment 30016 [details]
patch file and a sample document for the test cases

When a document contains one or more overlapping bookmarks the method BookmarkImpl.getEnd() returns the wrong index.

This is an excerpt from the MICROSOFT OFFICE WORD 97-2007 BINARY FILE FORMAT SPECIFICATION

Since bookmarks may be nested within one another to any level, the BKF structure stored in the plcbkf consists of a single index that identifies which plcbkl marks the end of the bookmark.
Comment 1 Josh Holthaus 2013-03-05 05:29:00 UTC
Created attachment 30018 [details]
patch file and a sample document for the test cases

Decided to use LittleEndian.getUShort() instead of LittleEndianByteArrayInputStream.readUShort()
Comment 2 Dominik Stadler 2015-09-29 21:06:11 UTC
Does this also work if the Bookmark is updated? I.e. setStart()/setEnd() is called on the bookmark? I fear this will not update the _buf and thus not affect your changed code then, or?
Comment 3 Josh Holthaus 2015-11-09 21:30:13 UTC
(In reply to Dominik Stadler from comment #2)
> Does this also work if the Bookmark is updated? I.e. setStart()/setEnd() is
> called on the bookmark? I fear this will not update the _buf and thus not
> affect your changed code then, or?

I was using this in a read only mode so I did not take into account updating the Bookmark. I'm not even sure where they would be updated from. The Bookmark interface only supports getStart()/getEnd(). There are no set methods for these values.
Comment 4 Dominik Stadler 2016-03-12 14:56:49 UTC
Setting to NEEDINFO as the patch requires more work to handle write-support before it can be applied.
Comment 5 Dominik Stadler 2019-03-10 16:21:35 UTC
We did not receive an updated patch here for a very long time so this is probably outdated by now, please provide an enhanced/refreshed patch based on latest trunk if this is still a problem for you.