changeset 34704:28a745cebcc4

maint: merge stable to default
author Rik <rik@octave.org>
date Sat, 12 Jul 2025 06:50:28 +0200
parents 0aa3318a4812 b9cd19efa510
children 38180b218448
files liboctave/system/oct-group.cc
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/oct-group.cc
+++ b/liboctave/system/oct-group.cc
@@ -195,7 +195,12 @@
 
   if (p)
     {
-      struct ::group *gr = static_cast<struct ::group *> (p);
+      // struct ::group *gr = static_cast<struct ::group *> (p);
+      // Ths code assumes memory alignment that is not the case on MacOS.
+      // Copy struct group to aligned local storage.
+      struct ::group tmpgr;
+      std::memcpy (&tmpgr, p, sizeof (tmpgr));
+      struct ::group *gr = &tmpgr;
 
       m_name = gr->gr_name;