-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
napi: zero length typedarray in 12 vs 13 #32089
Comments
… what is the (un)expected behaviour here? It seems perfectly fine to me to return any pointer for a zero-length ArrayBuffer, including (I’m guessing that this is happening because of V8’s |
In the case, the length shall always be respected even if the pointer is not |
We had logic there we checked if a pointer was NULL to see we had load it from the typed_array method, which this broke. As mentioned, it might be a feature but having it documented would have saved us debugging. |
Signed-off-by: Michael Dawson <[email protected]> Fixes: nodejs#32089
Signed-off-by: Michael Dawson <[email protected]> Fixes: #32089 PR-URL: #32603 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Signed-off-by: Michael Dawson <[email protected]> Fixes: #32089 PR-URL: #32603 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Signed-off-by: Michael Dawson <[email protected]> Fixes: #32089 PR-URL: #32603 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
We just hit this bug, which may be a feature, but at least not documented where in Node.js
13, the
napi_get_typedarray_info
returnsNULL
as the data pointer for 0 length typedarrays but Node.js 12 returns a pointer.This C program shows the difference:
Compile it and run it with
Node.js 12 returns a pointer and 13
NULL
.The text was updated successfully, but these errors were encountered: