Article View: linux.debian.bugs.dist
Article #2368Bug#1150883: luabind: object_rep buffer over-aligned for lua_newuserdata memory, tests segfault with LTO
From: Iliya Abolghasemi
Date: Tue, 27 Oct 2026 14:00
Date: Tue, 27 Oct 2026 14:00
65 lines
4805 bytes
4805 bytes
On Wed, 14 Oct 2026 11:08:52 +0200 Sebastien Bacher <sebastien.bacher@canonical.com> wrote:
> From 49814f6b47ed99e273edc5198a6ebd7fa19e813a Mon Sep 17 00:00:00 2001
> From: Jan Boon <kaetemi@gmail.com>
> Date: Sat, 19 Feb 2022 17:30:38 +0100
> Subject: [PATCH] Fix bad alignment assumption in `object_rep` broken by
> lua_newuserdata (#50)
>
> * Match alignment of `object_rep` to `lua_newuserdata`. Fixes alignment assumption in placement new
> * Compatibility with lua 5.3
>
> Origin: other, https://github.com/Oberon00/luabind/commit/49814f6b47ed99e273edc5198a6ebd7fa19e813a
> Bug: https://github.com/Oberon00/luabind/issues/42
> Forwarded: not-needed
> Last-Update: 2026-10-14
>
> ---
> luabind/detail/object_rep.hpp | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/luabind/detail/object_rep.hpp b/luabind/detail/object_rep.hpp
> index 07272e64..519f7140 100644
> --- a/luabind/detail/object_rep.hpp
> +++ b/luabind/detail/object_rep.hpp
> @@ -97,8 +97,14 @@ namespace luabind { namespace detail
>
> void operator=(object_rep const&);
>
> +#ifdef LUAI_MAXALIGN
> + struct cD { char c; union { LUAI_MAXALIGN; } u; };
> +#else
> + struct cD { char c; union { lua_Number n; double u; void *s; lua_Integer i; long l; } u; };
> +#endif
> BOOST_STATIC_CONSTANT(std::size_t, instance_buffer_size=32);
> - boost::aligned_storage<instance_buffer_size> m_instance_buffer;
> + BOOST_STATIC_CONSTANT(std::size_t, instance_buffer_align=offsetof(struct cD, u));
> + boost::aligned_storage<instance_buffer_size, instance_buffer_align> m_instance_buffer;
> instance_holder* m_instance;
> class_rep* m_classrep; // the class information about this object's type
> std::size_t m_dependency_cnt; // counts dependencies
Hi Sebastien,
I currently working on next release,
next release also contain your sended patch, and after next release get upload to unstable
this submited bug must be close too.
Thanks for your report.
Regards.
--
Iliya Abolghasemi (gfaerny)
Fingerprint: 4DEF 5756 FDE5 C5EC 9B3D FB3C DC84 0F69 C960 72C3
https://gfaerny.cc
Technical Details
Message-ID:
<NSPSy-8ffP-7@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!news.servidellagleba.it!bofh.it!news.nic.it!robomodReferences:
<NSPSy-8ffP-9@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From: "Iliya Abolghasemi" <gfaerny@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1150883: luabind: object_rep buffer over-aligned for lua_newuserdata memory, tests segfault with LTO
Date: Tue, 27 Oct 2026 15:00:02 +0100
Message-ID: <NSPSy-8ffP-7@gated-at.bofh.it>
References: <NSPSy-8ffP-9@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Tue Oct 27 13:53:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -0.547
Reply-To: "Iliya Abolghasemi" <gfaerny@gmail.com>, 1150883@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: gfaerny@gmail.com
X-Debian-Pr-Message: followup 1150883
X-Debian-Pr-Package: src:luabind
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: luabind
X-Gm-Message-State: AFq9FYIEcuBr7Fwa0d0MB4taZaCT2/bQPGCe7HtaJzj7R0Yu/6An23X3
6/Vrvw3U7PPcCYkirPhw9H4vuK/K2si2XdScTN2YpmiP2tVsVfK1k+DzAIfCNq/94r5htw==
X-Gm-Gg: AYBFou2yAP5tilPTSK7MuuDIHdlnWUuvNMHc/5yTJZNnnuHDGH6Ty9YgJlME0Ud81GW
Y+9fRqZZ83MqyX3Uo0cj2Rg0XC8nCcIrkCW2xFRl75a4Q9bhLi+r4I9FEL6ZSqAJzcy7JIa2kYT
6X5QdwqP3gg7+2xto9AcI+60E2oCrmB4wg048JFvi/qUapy2rXKrvdt8sX9Xaah5+J/ijpL08Nr
9LdhHvSIRSGff2OliEEos5e9fJvYBrFxRn0HE/lSPgU4krxixPfhISaLtRVIX7uB+kExoC3eHjI
Q22StUPXxyHv2zahnNOAFKeacFOUQZviUm+9ULXkJBurqSfZW9RAb61QnuROG5ec5VqF+YWScwL
TzrX49Ckq6z4v12ulc953uQTmPPnlEybh1p2EHFh1mrqjk3pVUE2eS6yVXe+R/L9NDEYkfnMb2T
9AE0y0femFvMWvbV2x3XZkDJe47a6Q4bDLwuOp2Bp8wK67uEbaY1te3CNhc7enFMSDUkelnzJsj
G2AdkkS2vu8UbPtBeSbU39879TLy91qsoAjuYCNWM/DGg==
X-Received: by 2002:a17:907:3e93:b0:c42:102f:15df with SMTP id a640c23a62f3a-c46bdd6fc13mr1121733066b.8.1793109055455;
Tue, 27 Oct 2026 06:50:55 -0700 (PDT)
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
X-Mailer: aerc 0.22.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1999205
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 65
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Tue, 27 Oct 2026 17:27:56 +0330
X-Original-Message-ID: <DMFO9DSUISOX.3TLFBAYR2DJ9X@gmail.com>
X-Original-References: <CAD04=womrOagR-aAxV3_-oFRGJaRBxXDLXo_bNTXyWkCWTFtbw@mail.gmail.com>