diff options
author | John Högberg <[email protected]> | 2018-02-12 09:22:19 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-02-12 09:22:19 +0100 |
commit | 1b3b4386c220e81395c04215d15c727cfdacb65b (patch) | |
tree | 8c4da7fa31af219cc2b87253de9cea1a894a4fce /erts/emulator/beam | |
parent | cd9b6371a13c37f8f82586fcd82f212d306d8fad (diff) | |
download | otp-1b3b4386c220e81395c04215d15c727cfdacb65b.tar.gz otp-1b3b4386c220e81395c04215d15c727cfdacb65b.tar.bz2 otp-1b3b4386c220e81395c04215d15c727cfdacb65b.zip |
Make sure that the overwrite in bs_context_to_binary is safe
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/bs_instrs.tab | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/erts/emulator/beam/bs_instrs.tab b/erts/emulator/beam/bs_instrs.tab index b11903a47b..94e0000c8b 100644 --- a/erts/emulator/beam/bs_instrs.tab +++ b/erts/emulator/beam/bs_instrs.tab @@ -990,6 +990,9 @@ ctx_to_bin.execute() { Uint hole_size; Uint orig = mb->orig; ErlSubBin* sb = (ErlSubBin *) boxed_val(context); + /* Since we're going to overwrite the match state with the result, an + * ErlBinMatchState must be at least as large as an ErlSubBin. */ + ERTS_CT_ASSERT(sizeof(ErlSubBin) <= sizeof(ErlBinMatchState)); hole_size = 1 + header_arity(sb->thing_word) - ERL_SUB_BIN_SIZE; sb->thing_word = HEADER_SUB_BIN; sb->size = BYTE_OFFSET(size); |