Skip to content

reject attribute layout call that does not resolve to a callable - #816

Open
kali834x wants to merge 1 commit into
apache:masterfrom
kali834x:pack200-unresolved-call
Open

kali834x wants to merge 1 commit into
apache:masterfrom
kali834x:pack200-unresolved-call

Conversation

@kali834x

Copy link
Copy Markdown
Contributor

Unchecked NullPointerException from an unresolvable attribute layout call

When a custom attribute layout contains a call whose index points past the available callables (for example [(1)], a lone callable whose body forward-calls a non-existent callable), NewAttributeBands.resolveCallsForElement leaves the Call's callable unset. Call.readBands later dereferences it through callable.addCount(count), so parseAttributes throws a raw NullPointerException even though it only declares IOException / Pack200Exception, and the unchecked exception escapes the Pack200CompressorInputStream constructor and the Archive / Segment unpack entry points. The call is now rejected with a Pack200Exception at resolution time; layouts whose calls resolve are unchanged.

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Claude Code (Anthropic) was used to help locate the defect, draft the patch and the regression test, and write this description; every change was reviewed and validated locally.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

A forward or backward call whose index exceeds the surrounding callables left Call.callable null and NPEd later in readBands; reject it with a Pack200Exception so a crafted archive stays within the declared IOException contract.
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.

1 participant