RFR: 8355077: Compiler error at splashscreen_gif.c due to unterminated string initialization

Phil Race prr at openjdk.org
Fri Apr 25 21:01:46 UTC 2025


On Sun, 20 Apr 2025 02:16:50 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> I tried to build OpenJDK with GCC 15.0.1 on Fedora 42 x86_64, however I saw following error.
> 
> 
> * For target support_native_java.desktop_libsplashscreen_splashscreen_gif.o:
> /home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c:51:41: error: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (12 chars into 11 available) [-Werror=unterminated-string-initialization]
>    51 | static const char szNetscape20ext[11] = "NETSCAPE2.0";
>       | ^~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> 
> 
> This constant seems to be used to detect Netscape 2.0 extension in GIF image. It should be used to compare with extension block without NUL char, but we should tweak initialization to avoid this error for safety code.

Marked as reviewed by prr (Reviewer).

hmm. yes, it looks like it is enabled by -Wextra
https://gcc.gnu.org/pipermail/gcc-patches/2024-June/656014.html

Ok. let's make the change as the easiest thing to do.

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

PR Review: https://git.openjdk.org/jdk/pull/24770#pullrequestreview-2795266811
PR Comment: https://git.openjdk.org/jdk/pull/24770#issuecomment-2831420230


More information about the client-libs-dev mailing list