-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix possible itemsize
overflows in usm_ndarray
from-pointer constructors
#2003
Conversation
When a bad typenum is passed to functions which make usm_ndarrays from pointers, there was a possible underflow, as itemsize was declared size_t Instead declare itemsize as int and cast to size_t when needed (as itemsize should always fit in int)
2a683e9
to
292bc2a
Compare
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_527 ran successfully. |
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_527 ran successfully. |
Array API standard conformance tests for dpctl=0.19.0dev0=py310h93fe807_530 ran successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you @ndgrigorian
C-API functions which make a
usm_ndarray
from a pointer (UsmNDArray_MakeSimpleFromPtr
andUsmNDArray_MakeFromPtr
) take an integraltypenum
argumentIf this argument is invalid, the
itemsize
declared in the functions would be returned fromtype_bytesize
as -1 and could potentially overflow