-
Notifications
You must be signed in to change notification settings - Fork 31
Fix possible itemsize overflows in usm_ndarray from-pointer constructors
#2003
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
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. |
antonwolfy
left a comment
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_ndarrayfrom a pointer (UsmNDArray_MakeSimpleFromPtrandUsmNDArray_MakeFromPtr) take an integraltypenumargumentIf this argument is invalid, the
itemsizedeclared in the functions would be returned fromtype_bytesizeas -1 and could potentially overflow