summaryrefslogtreecommitdiff
path: root/ext/ffi/00_ffi.js
diff options
context:
space:
mode:
authorDj <43033058+DjDeveloperr@users.noreply.github.com>2023-04-01 09:26:02 +0530
committerGitHub <noreply@github.com>2023-04-01 09:26:02 +0530
commitc162647020c26de1d27064b488ca11525f1bc4bf (patch)
tree12709a19c838e4a00b65e334dc74e983ace0f0c2 /ext/ffi/00_ffi.js
parentbafffa95a08765085ab0bb43732d268038a46630 (diff)
fix(ext/ffi): crash when same reference struct is used in two fields (#18531)
fix #17482
Diffstat (limited to 'ext/ffi/00_ffi.js')
-rw-r--r--ext/ffi/00_ffi.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js
index c7ca21975..3664ae73b 100644
--- a/ext/ffi/00_ffi.js
+++ b/ext/ffi/00_ffi.js
@@ -313,8 +313,9 @@ function getTypeSizeAndAlignment(type, cache = new SafeMap()) {
size += fieldSize;
}
size = MathCeil(size / alignment) * alignment;
- cache.set(type, size);
- return [size, alignment];
+ const result = [size, alignment];
+ cache.set(type, result);
+ return result;
}
switch (type) {