RFR: 8320222: Wrong bytecode accepted, and StackMap table generated [v2]

Jan Lahoda jlahoda at openjdk.org
Tue Nov 21 10:01:06 UTC 2023


On Mon, 20 Nov 2023 17:17:15 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Stack map generator in ClassFile API performs only minimal checks in favour of performance.
>> However it led to situations where it generates invalid stack maps for corrupted code.
>> This patch adds basic checks of stack when two frames are merged and throws an exception in case of stack size or content mismatch. Generated or transformed code with inconsistent stack will fail on stack maps generation.
>> Relevant tests are added.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   changed StackMapGenerator::generatorError to return an exception instead of directly throw

Looks reasonable to me.

-------------

Marked as reviewed by jlahoda (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16685#pullrequestreview-1741564607


More information about the core-libs-dev mailing list