dschmidt opened a new pull request, #3263: URL: https://github.com/apache/tika/pull/3263
https://issues.apache.org/jira/browse/TIKA-4936 `ExecutableParser` so far only read the COFF header of PE files. This PR makes it continue through the optional header and section table to the resource section and rebuild every `RT_GROUP_ICON` together with its `RT_ICON` images into a standalone `.ico` file, which is handed to the `EmbeddedDocumentExtractor` as `image/vnd.microsoft.icon`. - The first group in resource order (the icon Windows shows for the file) is marked `THUMBNAIL`, the others `ATTACHMENT`; `embeddedRelationshipId` carries `type/name/language` of the resource. Resource names are `icon_<name-or-id>.ico`, with a language suffix only when a group has several language variants. - Single `RT_ICON` entries are deliberately not emitted on their own: BMP-encoded entries are not valid standalone images and would duplicate the group data. - The extractor reads strictly forward (no seeking), bounds-checks every offset, caps tree depth, entry count and section size, detects cycles and treats a truncated resource section as "fewer icons" rather than an error. Failures in the resource section are recorded as an embedded stream exception and never cost the header metadata. - New `extractIcons` property on `ExecutableParser` (default `true`) to turn the feature off. - `parsePE()` now takes `TikaInputStream` and `ParseContext`; it was only called internally. Test fixtures are a MinGW-built PE32 EXE and PE32+ DLL with two icon groups (numeric id `1` and named `DOCICON`; BMP 16/32/48 px and PNG 256 px images) plus the source `.ico` files, so the tests check that the rebuilt icons are byte identical. Further tests cover an EXE without icons, `extractIcons=false` and truncation at several offsets inside the resource section. Not included, possible follow-ups: `RT_GROUP_CURSOR`/`RT_CURSOR` as `.cur`, `RT_MANIFEST` as embedded XML, `VS_VERSIONINFO` as metadata. `CHANGES.txt` not touched since there is no unreleased section yet. Module `verify` (tests, checkstyle, forbiddenapis, rat) passes on `tika-parser-code-module`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
