Skip to content

synchronize lazy unpacking in bcel classfile attributes - #364

Open
nabhan06 wants to merge 1 commit into
eclipse-aspectj:masterfrom
nabhan06:linenumbertable-unpack-sync
Open

synchronize lazy unpacking in bcel classfile attributes#364
nabhan06 wants to merge 1 commit into
eclipse-aspectj:masterfrom
nabhan06:linenumbertable-unpack-sync

Conversation

@nabhan06

Copy link
Copy Markdown

LineNumberTable, BootstrapMethods and MethodParameters unpack their raw attribute bytes lazily on the first getter call, but unlike the already-fixed sibling LocalVariableTable they leave unpack()/ensureInflated() and the matching setter/dump unsynchronized. When the same attribute instance parsed from a class is read from more than one weaver thread, one thread can null the shared data array and swap the table reference while another is still inside unpack(), so a caller sees a NullPointerException or a half-populated table back from getTableLength()/getLineNumberTable(). This mirrors the LocalVariableTable fix by synchronizing the lazy-init and its mutators so the fields are published safely, and adds a LineNumberTableConcurrencyTest alongside the existing LocalVariableTableConcurrencyTest that hits the race (NPE before the change) and passes after.

Signed-off-by: sayed nabhan <nabhan@bugqore.com>
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