Multiple similar issues detected in PLATFORM_API_MacOSX_Ports.cpp more info about https://github.com/llvm/llvm-project/issues/62836
jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 127 | AudioDeviceID devices[count]; | ^~~~~ jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: note: read of non-const variable 'count' is not allowed in a constant expression jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:126:21: note: declared here 126 | int count = size/sizeof(AudioDeviceID); The usage of VLA has been replaced with malloc/calloc and free, which are already used in this file. Note that while this patch adds some validation, I am pretty sure it is still possible to crash these code paths if they are executed concurrently. Access to the native pointers being passed around is not properly synchronized. ------------- Commit messages: - Update PLATFORM_API_MacOSX_Ports.cpp Changes: https://git.openjdk.org/jdk/pull/24937/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24937&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8355561 Stats: 60 lines in 1 file changed: 37 ins; 0 del; 23 mod Patch: https://git.openjdk.org/jdk/pull/24937.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/24937/head:pull/24937 PR: https://git.openjdk.org/jdk/pull/24937