m-koops opened a new issue, #1126: URL: https://github.com/apache/poi/issues/1126
While loading the tabstop descriptors the offset in the byte[] is not calculated properly, leading to interpreting the wrong bytes for tabstop alignment and leader attributes. According to section [2.9.179 PChgTabsAdd of the Word binary format description](https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-doc/691c20a1-915b-4403-9813-1f0c96ed6f8b), the byte array for tabstop attributes of the `ParagraphProperties` should be read as: - `cb`, 1 byte - unsigned int holding the total byte size of the operand structure, after the cb byte (2 <= value <= 255) - followed by repeating (0 or more) `PChgTabsDel` structures (to ignore/delete existing tabstops) - followed by repeating (0 or more) `PChgTabsAdd` structures to define new tabstops A `PChgTabsAdd` structure in its turn consists of: - `cTabs`, 1 byte - unsigned int holding the number of tabs to add (value <= 64) - followed by repeating (cTabs times) `rgdxaAdd` values, each 2 bytes/16 bits long, holding the horizontal positions of the tabstops defined in twips - followed by repeating (cTabs times) `rgtbdAdd` values, each 1 byte/8 bits long, holding the `jc` and `tlc` coding for alignment and leader definition for the tabstops. It is in the iteration in `handleTabs()` to read the repeating elements in the `PChgTabsAdd` structure that the `rgtbdAdd` values are extracted using a wrong offset: the offset should jump `cTabs` * 2 bytes (= `LittleEndianConsts.SHORT_SIZE`) after the start of the sequence instead of `cTabs` * 1 byte (= `TBDAbstractType.getSize()`). -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
