RFR: 8355561: [macos] Build failure with Xcode 16.3
Sergey Bylokhov
serb at openjdk.org
Mon Apr 28 21:55:19 UTC 2025
On Mon, 28 Apr 2025 19:47:03 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> 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.
src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp line 242:
> 240: if (!mixer) {
> 241: return nullptr;
> 242: }
This is a pre-existing bug; the caller code is already prepared to handle null.
https://github.com/openjdk/jdk/blob/62d165d0e4e5ab1bcef35d5031554a354052c6d5/src/java.desktop/share/classes/com/sun/media/sound/PortMixer.java#L76 -> https://github.com/openjdk/jdk/blob/62d165d0e4e5ab1bcef35d5031554a354052c6d5/src/java.desktop/share/native/libjsound/PortMixer.c#L45 -> PORT_Open
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24937#discussion_r2064842332
More information about the client-libs-dev
mailing list