You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "m-koops (via GitHub)" <gi...@apache.org> on 2026/06/10 06:33:29 UTC

[I] Offset miscalculation in ParagraphSprmUncompressor.handleTabs() [poi]

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: dev-unsubscribe@poi.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: [I] Offset miscalculation in ParagraphSprmUncompressor.handleTabs() [poi]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #1126:
URL: https://github.com/apache/poi/issues/1126#issuecomment-4679156753

   #1127 merged


-- 
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: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: [I] Offset miscalculation in ParagraphSprmUncompressor.handleTabs() [poi]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning closed issue #1126: Offset miscalculation in ParagraphSprmUncompressor.handleTabs()
URL: https://github.com/apache/poi/issues/1126


-- 
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: dev-unsubscribe@poi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org