aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-10-23 19:17:11 +0200
committerAnthony Ramine <[email protected]>2014-07-02 00:54:27 +0200
commitacf19fc9190985f643af06293141a1083f032563 (patch)
tree92868549ed3d0925f167a4b917956bda2a2f534c /erts/emulator/beam/io.c
parentc9e36ab16034bb7fe71f772df6bba22070976bbf (diff)
downloadotp-acf19fc9190985f643af06293141a1083f032563.tar.gz
otp-acf19fc9190985f643af06293141a1083f032563.tar.bz2
otp-acf19fc9190985f643af06293141a1083f032563.zip
Use offsetof() in io.c
This silences the following UBSan errors: beam/io.c:7131:27: runtime error: member access within null pointer of type 'ErlDrvSysInfo' beam/io.c:7140:20: runtime error: member access within null pointer of type 'ErlDrvSysInfo' beam/io.c:7166:20: runtime error: member access within null pointer of type 'ErlDrvSysInfo' beam/io.c:7174:20: runtime error: member access within null pointer of type 'ErlDrvSysInfo'
Diffstat (limited to 'erts/emulator/beam/io.c')
-rw-r--r--erts/emulator/beam/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index edf4a28784..c34a5b17d0 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -7166,7 +7166,7 @@ char *driver_dl_error(void)
#define ERL_DRV_SYS_INFO_SIZE(LAST_FIELD) \
- (((size_t) &((ErlDrvSysInfo *) 0)->LAST_FIELD) \
+ (offsetof(ErlDrvSysInfo, LAST_FIELD) \
+ sizeof(((ErlDrvSysInfo *) 0)->LAST_FIELD))
void