* lib/obstack.c (__alignof__) [!__GNUC__]: Default to alignof, not to alignof_type. * modules/obstack (Depends-on): Depend on alignasof directly, not indirectly via alignof. --- ChangeLog | 6 ++++++ lib/obstack.c | 3 +-- modules/obstack | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 9ee3f6eea5..cdef5a8973 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-05-05 Paul Eggert <egg...@cs.ucla.edu> + obstack: stop depending on alignof + * lib/obstack.c (__alignof__) [!__GNUC__]: + Default to alignof, not to alignof_type. + * modules/obstack (Depends-on): Depend on alignasof directly, + not indirectly via alignof. + obstack: fix unlikely buffer overrun in glibc This bug is not plausible on any Gnulib platform, but it could happen in glibc if the requested size is UINT_MAX. diff --git a/lib/obstack.c b/lib/obstack.c index 5839e04f2f..7d19f6bd3a 100644 --- a/lib/obstack.c +++ b/lib/obstack.c @@ -31,8 +31,7 @@ use the already-supplied __alignof__. Otherwise, this must be Gnulib (as glibc assumes GCC); defer to Gnulib's alignof_type. */ #if !defined __GNUC__ && !defined __alignof__ -# include <alignof.h> -# define __alignof__(type) alignof_type (type) +# define __alignof__(type) alignof (type) #endif #include <limits.h> diff --git a/modules/obstack b/modules/obstack index 322073a077..6b9ab18134 100644 --- a/modules/obstack +++ b/modules/obstack @@ -8,7 +8,7 @@ m4/obstack.m4 Depends-on: gen-header -alignof [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1] +alignasof [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1] gettext-h [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1] gnulib-i18n [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1] exitfail [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1] -- 2.49.0