FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: core: result_type(0, np.timedelta64(4)) would seg. fault. by charris · Pull Request #20106 · numpy/numpy · GitHub

/ numpy Public

BUG: core: result_type(0, np.timedelta64(4)) would seg. fault. - #20106

Merged
charris merged 1 commit into
numpy:maintenance/1.21.xfrom
charris:backport-20088
Oct 12, 2021
Merged

charris merged 1 commit into
numpy:maintenance/1.21.xfrom
charris:backport-20088

Conversation

charris commented Oct 12, 2021

Copy link
Copy Markdown
Member

Backport of #20088.

Before this change, the line in convert_datatype.c

result = PyArray_CastDescrToDType(all_descriptors[0], common_dtype);

would trigger a seg. fault with a call such as

np.result_type(0, np.timedelta64(4))

The problem was that all_descriptors[0] was NULL, and it was
dereferenced in PyArray_CastDescrToDType.

The code in the loop that followed the above line avoided passing
NULL values in all_descriptors[i] to PyArray_CastDescrToDType by
checking that the corresponding input argument to result_type
was not a Python scalar. A different code path was taken in that
case. The seg. fault is fixed by applying that same check to the
first argument.

Closes gh-20077.

charris added this to the 1.21.3 release milestone Oct 12, 2021
charris merged commit c36c4e3 into numpy:maintenance/1.21.x Oct 12, 2021
charris deleted the backport-20088 branch October 12, 2021 19:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL