You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2023/05/02 23:44:09 UTC
[Bug 66590] New: Number of blocks used by the property table missing from the file header
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
Bug ID: 66590
Summary: Number of blocks used by the property table missing
from the file header
Product: POI
Version: 5.2.3-FINAL
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: POIFS
Assignee: dev@poi.apache.org
Reporter: ebourg@apache.org
Target Milestone: ---
I'm using POIFS to modify MSI files (for Authenticode signing with Jsign) and
for some files the addition of an entry corrupts the file. I've tracked down
the issue to the number of blocks used by the property table in the file header
(at offset 0x28) which is not handled by POIFS. When the header is parsed the
value of this field is ignored, and when the header is saved the actual number
of blocks is never written.
This is problematic because msiexec.exe relies on this field to parse the
content of the MSI files, it won't process the full stream of the property
table even if its chain in the allocation table spans over more blocks. When
the entry added by the signing process is located on a new block of the
property table, the binary tree holding the properties is re-balanced and a
part is grafted to the new entry. Since the number of blocks isn't updated in
the header this part of the tree becomes unreachable and the file is corrupted.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
Emmanuel Bourg <eb...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |PatchAvailable
Status|NEEDINFO |NEW
--- Comment #3 from Emmanuel Bourg <eb...@apache.org> ---
The fix is ready to be reviewed: https://github.com/apache/poi/pull/462
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
Sebastian Stamm <s....@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |s.stamm89@gmail.com
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
Emmanuel Bourg <eb...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #6 from Emmanuel Bourg <eb...@apache.org> ---
Fixed in 5.4.0
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
https://github.com/apache/poi/pull/728 says:
The header field must be updated only if the file uses 4K blocks. If small
blocks are used the field must remain nul.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
--- Comment #4 from Emmanuel Bourg <eb...@apache.org> ---
The fix is incomplete, according to the CFB specification the number of
directory sectors must be set to zero for files using the format version 3
(with 512 byte sectors). I'll update the patch.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
--- Comment #2 from Nick Burch <ap...@gagravarr.org> ---
The code to work with the file header is:
https://github.com/apache/poi/blob/trunk/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlock.java
And the offsets are defined in:
https://github.com/apache/poi/blob/trunk/poi/src/main/java/org/apache/poi/poifs/storage/HeaderBlockConstants.java
For most of the things tracked we have a start and a count, but for properties
we only have the count
The documentation for the header is:
https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/05060311-bfce-4b12-874d-71fd4ce63aea
As PJ Fanning says, we don't have any MSI support, and no unit tests for it. If
you want to work on this, we'll need test MSI files to go with the unit tests
for the fix. As well as updating the header code to read/store the additional
value, you'll also need to update other bits of POIFS code to tell the header
of the new count. Good luck!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
POI does not have explicit support for MSI files. There are no tests that I can
find in our code base for MSI files. I don't see any mention of MSI in our
docs.
If you would like to work on adding some MSI support and some test coverage,
the POI community may be in a position to review it.
The POI Community is not very active and it is unlikely that someone else will
volunteer to do this work for you.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
Sebastian Stamm <s....@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|s.stamm89@gmail.com |
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 66590] Number of blocks used by the property table missing from the file header
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=66590
PJ Fanning <fa...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org