zlib: fix pointer alignment · nodejs/node@17965eb · GitHub
Skip to content

Commit 17965eb

Browse files
jhofsteeRafaelGSS
authored andcommitted
zlib: fix pointer alignment
The function AllocForBrotli prefixes the allocated memory with its size, and returns a pointer to the region after it. This pointer can however no longer be suitably aligned. Correct this by allocating the maximum of the the size of the size_t and the max alignment. On Arm 32bits the size_t is 4 bytes long, but the alignment is 8 for some NEON instructions. When Brotli is compiled with optimizations enabled newer GCC versions will use the NEON instructions and trigger a bus error killing node. see google/brotli#1159 PR-URL: #57727 Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
1 parent 0bf2c28 commit 17965eb

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/node_zlib.cc

Lines changed: 5 additions & 3 deletions

0 commit comments

Comments
 (0)