You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to understand a difference between node 16/18/20 and node 22.
Specifically, node-ffi-napi uses 0 length buffers to represent function pointers in it's tests.
16/18/20 fail these tests, where napi_create_external_buffer(env, ptr, 0, NULL, NULL, &val) fills val with a null pointer, when ptr is valid.
22 passes the tests, and val contains a valid pointer to ptr, and a length of zero.
I assume this used to pass in node version up to 12 at least...
If I instead call with napi_create_external_buffer(env, ptr, 8, NULL, NULL, &val), tests pass on node 20 (not tried 16 & 18 yet), and the buffer returned has a valid pointer, but has a length of 8.
I'm finding it very difficult to locate a change in the NodeJS sources.
but I modified it to use napi_create_external_buffer directly to check one level down, and behaviour is the same in both cases.
So; what is the expected behaviour when passing a valid pointer, and 0 in the length parameter?
In terms of making the tests work for 16/18/20, should I just pass 8 as the length, and can anyone think of a reason this may be bad?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I'm trying to understand a difference between node 16/18/20 and node 22.
Specifically, node-ffi-napi uses 0 length buffers to represent function pointers in it's tests.
16/18/20 fail these tests, where napi_create_external_buffer(env, ptr, 0, NULL, NULL, &val) fills val with a null pointer, when ptr is valid.
22 passes the tests, and val contains a valid pointer to ptr, and a length of zero.
I assume this used to pass in node version up to 12 at least...
If I instead call with napi_create_external_buffer(env, ptr, 8, NULL, NULL, &val), tests pass on node 20 (not tried 16 & 18 yet), and the buffer returned has a valid pointer, but has a length of 8.
I'm finding it very difficult to locate a change in the NodeJS sources.
The ACTUAL code in the tests is
but I modified it to use napi_create_external_buffer directly to check one level down, and behaviour is the same in both cases.
So; what is the expected behaviour when passing a valid pointer, and 0 in the length parameter?
In terms of making the tests work for 16/18/20, should I just pass 8 as the length, and can anyone think of a reason this may be bad?
br,
Simon
Beta Was this translation helpful? Give feedback.
All reactions