After https://bugs.openjdk.org/browse/JDK-8345687 was integrated, zero-length segments always have an address of zero. This may cause problems in certain native methods that can receive segments and/or buffers derived from segments.
This PR also guards for overflow for extremely large allocation requests. ------------- Commit messages: - Fix zero-length allocation Changes: https://git.openjdk.org/jdk/pull/25485/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25485&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8357919 Stats: 28 lines in 2 files changed: 28 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/25485.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25485/head:pull/25485 PR: https://git.openjdk.org/jdk/pull/25485