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

Yasumasa Suenaga ysuenaga at openjdk.org
Sun Apr 20 05:07:31 UTC 2025


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.

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

Commit messages:
 - 8355077: Compiler error at splashscreen_gif.c due to unterminated string initialization

Changes: https://git.openjdk.org/jdk/pull/24770/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24770&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8355077
  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/24770.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24770/head:pull/24770

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


More information about the client-libs-dev mailing list