From: Bruno Haible Date: Sat, 12 Apr 2025 21:48:28 +0000 (+0200) Subject: vasnprintf tests: Add a test case that showcases a Solaris bug. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=586f0406f42677230b1a279eb7997d0c35186b05;p=gnulib.git vasnprintf tests: Add a test case that showcases a Solaris bug. * tests/test-vasnprintf-posix2.c (main): Add one more %'g test. * tests/test-vasnwprintf-posix2.c (main): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 33cae49b8e..dbd51b5402 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2025-04-12 Bruno Haible + + vasnprintf tests: Add a test case that showcases a Solaris bug. + * tests/test-vasnprintf-posix2.c (main): Add one more %'g test. + * tests/test-vasnwprintf-posix2.c (main): Likewise. + 2025-04-12 Collin Funk stdlib: Avoid syntax errors in libstdc++ header files on AIX. diff --git a/tests/test-vasnprintf-posix2.c b/tests/test-vasnprintf-posix2.c index b0ba95b667..55e26d666f 100644 --- a/tests/test-vasnprintf-posix2.c +++ b/tests/test-vasnprintf-posix2.c @@ -439,6 +439,13 @@ main (int argc, char *argv[]) } free (result); } + /* This test used to crash in the Solaris libc, for all Solaris versions. + */ + { + size_t length; + char *result = asnprintf (NULL, &length, "%'.500Lg\n", 42351647362715016953416125033982098102569580078125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0L); + free (result); + } } return test_exit_status; diff --git a/tests/test-vasnwprintf-posix2.c b/tests/test-vasnwprintf-posix2.c index 4ccbe079ae..394e872e26 100644 --- a/tests/test-vasnwprintf-posix2.c +++ b/tests/test-vasnwprintf-posix2.c @@ -345,6 +345,11 @@ main (int argc, char *argv[]) && wcscmp (result + 7, L"000") == 0); free (result); } + { + size_t length; + wchar_t *result = asnwprintf (NULL, &length, L"%'.500Lg\n", 42351647362715016953416125033982098102569580078125000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0L); + free (result); + } } return test_exit_status;