File 0527-beam-external-don-t-blow-assert-on-encounter-with-a-.patch of Package erlang
From 9061696d8450e414ac9423cda7059b5f72aeedba Mon Sep 17 00:00:00 2001
From: Alex Wilson <alex@cooperi.net>
Date: Tue, 7 Nov 2023 14:25:02 +1000
Subject: [PATCH] beam/external: don't blow assert on encounter with a magic
binary
Magic binaries might have data outside their actual Binary struct
so we shouldn't try to assert about where their data is here.
---
erts/emulator/beam/external.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 36dad669d9..32affb6b6c 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -4015,8 +4015,12 @@ store_in_vec_aux(TTBEncodeContext *ctx,
Uint iov_len;
ErlIOVec *feiovp;
- ASSERT(((byte *) &bin->orig_bytes[0]) <= ptr);
- ASSERT(ptr + len <= ((byte *) &bin->orig_bytes[0]) + bin->orig_size);
+#ifdef DEBUG
+ if (!(bin->intern.flags & BIN_FLAG_MAGIC)) {
+ ASSERT(((byte *) &bin->orig_bytes[0]) <= ptr);
+ ASSERT(ptr + len <= ((byte *) &bin->orig_bytes[0]) + bin->orig_size);
+ }
+#endif
if (ctx->frag_ix >= 0) {
feiovp = &ctx->fragment_eiovs[ctx->frag_ix];
--
2.35.3