summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Maximov <amaxcz@gmail.com>2025-09-14 12:30:09 +0000
committerAlan Wu <XrXr@users.noreply.github.com>2025-09-25 16:03:15 -0400
commit354d47ae5bc4edcc94db4a5391ed71a8b9844e57 (patch)
tree1902a72b259b8b4c898aac2106547be624d986c2
parent5e817f98af9024f34a3491c0aa6526d1191f8c11 (diff)
IBF: Avoid unaligned load on 32 bit platforms
[Bug #21569]
-rw-r--r--compile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index d3b9704cc9..bb7f974b6b 100644
--- a/compile.c
+++ b/compile.c
@@ -14097,8 +14097,10 @@ ibf_dump_object_float(struct ibf_dump *dump, VALUE obj)
static VALUE
ibf_load_object_float(const struct ibf_load *load, const struct ibf_object_header *header, ibf_offset_t offset)
{
- const double *dblp = IBF_OBJBODY(double, offset);
- return DBL2NUM(*dblp);
+ double d;
+ /* Avoid unaligned VFP load on ARMv7; IBF payload may be unaligned (C99 6.3.2.3 p7). */
+ memcpy(&d, IBF_OBJBODY(double, offset), sizeof(d));
+ return DBL2NUM(d);
}
static void