rootvector2 opened a new pull request, #502:
URL: https://github.com/apache/commons-bcel/pull/502

   `Utility.codeToString` keeps the `WIDE`-prefix state in a mutable static 
`boolean wide`, so the flag is shared by every caller. Disassembling a `WIDE` 
opcode on one thread sets it, and a different thread decoding its next 
local-variable instruction (`iload`, `istore`, `ret`, `iinc`, ...) then reads a 
2-byte index instead of 1 and misparses the rest of that method's code. The 
generic parser already avoids this by keeping `wide` a local in 
`Instruction.readInstruction`, and the adjacent `CONSUMER_CHARS` 
signature-parser state in this same class was likewise moved to a 
`ThreadLocal`. This does the same for `wide` and updates the five 
read/clear/set sites.
   
   Found by comparing the two `wide` handlers. The added `UtilityTest` 
regression reproduces it deterministically: a `WIDE` disassembled on one thread 
makes an `iload` on another thread decode `%258` instead of `%1`, and it fails 
without the change.
   
   - [x] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
   - [ ] Read the [ASF Generative Tooling 
Guidance](https://www.apache.org/legal/generative-tooling.html) if you use 
Artificial Intelligence (AI).
   - [ ] I used AI to create any part of, or all of, this pull request. Which 
AI tool was used to create this pull request, and to what extent did it 
contribute?
   - [x] Run a successful build using the default 
[Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command 
line by itself.
   - [x] Write unit tests that match behavioral changes, where the tests fail 
if the changes to the runtime are not applied.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line 
and body.
   


-- 
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]

Reply via email to