Skip to content

Use unsigned element count when parsing EscherArrayProperty#1116

Merged
pjfanning merged 1 commit into
apache:trunkfrom
jmestwa-coder:escher-array-unsigned-count
Jun 4, 2026
Merged

Use unsigned element count when parsing EscherArrayProperty#1116
pjfanning merged 1 commit into
apache:trunkfrom
jmestwa-coder:escher-array-unsigned-count

Conversation

@jmestwa-coder
Copy link
Copy Markdown
Contributor

Summary

Use an unsigned element count when parsing EscherArrayProperty.

Changes

  • Replace LittleEndian.getShort() with LittleEndian.getUShort() when reading the array element count (nElems) in EscherArrayProperty#setArrayData.
  • Align parsing behavior with the existing unsigned accessors in the same class.
  • Ensure values in the full unsigned range (0-65535) are interpreted correctly.

Why

  • The element count field is treated as unsigned elsewhere in EscherArrayProperty.
  • Reading the field as a signed value can misinterpret counts greater than 32767.
  • This creates inconsistent behavior between parsing and subsequent access to the property data.

Tests

  • Added a regression test covering an element count larger than 32767.
  • Verified that the parsed complex data size is calculated correctly using the unsigned value.

Copy link
Copy Markdown
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pjfanning pjfanning merged commit 9d16d56 into apache:trunk Jun 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants