emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 89734c4f1d2: pdumder.c: Fix bug#68690


From: Stefan Monnier
Subject: master 89734c4f1d2: pdumder.c: Fix bug#68690
Date: Fri, 26 Jan 2024 23:08:22 -0500 (EST)

branch: master
commit 89734c4f1d2fb9aa18e44481174eb595134f497b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    pdumder.c: Fix bug#68690
    
    The problem was that the offset computed for the `charset_table` array
    was a multiple of 4 but the `struct charset` needed an alignment on
    a multiple of 8, so `dump_charset` inserted 4 bytes of padding,
    whereas you can't have padding at the beginning of an array.
    
    * src/pdumper.c (dump_charset): Don't set alignment here.
    (dump_charset_table): Set it here instead.
---
 src/pdumper.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/pdumper.c b/src/pdumper.c
index f42d1777371..6b0178227bd 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -3216,7 +3216,9 @@ dump_charset (struct dump_context *ctx, int cs_i)
 #if CHECK_STRUCTS && !defined (HASH_charset_E31F4B5D96)
 # error "charset changed. See CHECK_STRUCTS comment in config.h."
 #endif
-  dump_align_output (ctx, alignof (struct charset));
+  /* We can't change the alignment here, because `offset` is what
+     will be used for the whole array.  */
+  eassert (ctx->offset % alignof (struct charset) == 0);
   const struct charset *cs = charset_table + cs_i;
   struct charset out;
   dump_object_start (ctx, &out, sizeof (out));
@@ -3257,7 +3259,7 @@ dump_charset_table (struct dump_context *ctx)
 {
   struct dump_flags old_flags = ctx->flags;
   ctx->flags.pack_objects = true;
-  dump_align_output (ctx, DUMP_ALIGNMENT);
+  dump_align_output (ctx, alignof (struct charset));
   dump_off offset = ctx->offset;
   if (dump_set_referrer (ctx))
     ctx->current_referrer = build_string ("charset_table");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]