GH-49917: [Python] numpy_convert.cc memory management(Use-After-Free) Bugs for PyList_SetItem in SparseCSFTensorToNdarray#49916
GH-49917: [Python] numpy_convert.cc memory management(Use-After-Free) Bugs for PyList_SetItem in SparseCSFTensorToNdarray#49916wr-web wants to merge 2 commits intoapache:mainfrom
PyList_SetItem in SparseCSFTensorToNdarray#49916Conversation
Remove incorrect reference count decrement for item. apache#49915
Remove unnecessary reference count decrement for item. apache#49915
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
raulcd
left a comment
There was a problem hiding this comment.
Thanks for the PR. Can you use the PR description template instead of removing it?
Can you also use the expected title for the PR as described on the automated message?
|
(PR contents look good otherwise: |
PyList_SetItem in SparseCSFTensorToNdarray
Done |
PyList_SetItem in SparseCSFTensorToNdarrayPyList_SetItem in SparseCSFTensorToNdarray
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
PyList_SetItem in SparseCSFTensorToNdarrayPyList_SetItem in SparseCSFTensorToNdarray
|
|
raulcd
left a comment
There was a problem hiding this comment.
Thank you very much for the PR!
I've done a minor update to the title so our automated tools don't trip.
Rationale for this change
Py_DECREF(item) in PyList_SetItem will cause Use-After-Free bug if
PyList_SetItem(indptr.obj(), i, item) < 0istrue, causePyList_SetItemalways steals a reference to the item, even when it fails.What changes are included in this PR?
Are these changes tested?
By CI.
Are there any user-facing changes?
No.
PyList_SetIteminSparseCSFTensorToNdarray#49917