From 2d81a718eca679b9bf458beccf1e7a86b812c3e2 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 11 Jan 2022 15:19:39 -0500 Subject: Make embedded string length a long for VWA A short (2 bytes) will cause unaligned struct accesses when strings are used as a buffer to directly store binary data. --- include/ruby/internal/core/rstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ruby') diff --git a/include/ruby/internal/core/rstring.h b/include/ruby/internal/core/rstring.h index 4a8aa3f7d3..9f6dc84537 100644 --- a/include/ruby/internal/core/rstring.h +++ b/include/ruby/internal/core/rstring.h @@ -280,7 +280,7 @@ struct RString { /** Embedded contents. */ struct { #if USE_RVARGC - unsigned short len; + long len; /* This is a length 1 array because: * 1. GCC has a bug that does not optimize C flexible array members * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452) -- cgit v1.2.3