Fix the bug mentioned in the JBS issue.

The implementation is updated to slice the capture state segment using the 
capture state layout. This checks both that the segment is big enough, and that 
it is properly aligned.

Additionally, I added a check for `MS::NULL` since this is also an illegal 
value we can catch early.

Test cases are added for all three invalid values.

Testing: `jdk_foreign` test suite.

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

Commit messages:
 - Apply checks on capture state segment

Changes: https://git.openjdk.org/jdk/pull/14339/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14339&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8308445
  Stats: 48 lines in 4 files changed: 46 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/14339.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14339/head:pull/14339

PR: https://git.openjdk.org/jdk/pull/14339

Reply via email to