From: Christoph M. Becker Date: Tue, 28 Jan 2020 08:15:23 +0000 (+0100) Subject: Fix #79172: STRUCT_OFFSET() relies on undefined behavior X-Git-Tag: php-7.4.7RC1~270 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=412b476b7fb386c6aa04efb936881f5b2250ded9;p=php Fix #79172: STRUCT_OFFSET() relies on undefined behavior Since this pattern is understood by compilers, not a real issue, but certainly cleaner this way. --- diff --git a/ext/mysqlnd/mysqlnd_portability.h b/ext/mysqlnd/mysqlnd_portability.h index 873f49b0cd..2064906193 100644 --- a/ext/mysqlnd/mysqlnd_portability.h +++ b/ext/mysqlnd/mysqlnd_portability.h @@ -15,7 +15,7 @@ This file is public domain and comes with NO WARRANTY of any kind */ /* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */ -#define STRUCT_OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) +#define STRUCT_OFFSET(t, f) XtOffsetOf(t, f) #ifndef __attribute #if !defined(__GNUC__)