https://bz.apache.org/bugzilla/show_bug.cgi?id=69464

            Bug ID: 69464
           Summary: Duplicate entries caused by empty entries in the
                    middle of the directory
           Product: POI
           Version: 5.3.0-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POIFS
          Assignee: dev@poi.apache.org
          Reporter: ebo...@apache.org
  Target Milestone: ---

While working with MSI files I've spotted a case of duplicate entries in the
directory (aka property table) caused by empty entries in the middle of the
directory.

For example if the file has the following directory (assuming 512 byte sectors
and 4 entries per directory sector):

  --- Directory Sector 1 ---
  Entry 1
  Entry 2
  Entry 3
  <Empty>

  --- Directory Sector 2 ---
  <Empty>
  Entry 4
  Entry 5
  Entry 6

When adding an entry the directory is rewritten to:

  --- Directory Sector 1 ---
  Entry 1
  Entry 2
  Entry 3
  Entry 4

  --- Directory Sector 2 ---
  Entry 5
  Entry 6
  New Entry
  Entry 6 (duplicate)


The last entry of the directory sector 2 is not rewritten and the previous data
(Entry 6) is left there, creating a duplicate in the directory.

In comparison, in this situation the MS API (or at least signtool when signing
files) seems to fill in the gaps in the directory, and the remaining empty
entries are left as is. The modified directory looks like this:

  --- Directory Sector 1 ---
  Entry 1
  Entry 2
  Entry 3
  New Entry

  --- Directory Sector 2 ---
  <Empty>
  Entry 4
  Entry 5
  Entry 6

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to