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
Change maybe_resize_storage_cpu
new_size
arg to unsigned
#52671
Closed
Closed
Conversation
This file contains 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
Current code is written with the assumption that `new_size` is unsigned value, and when function is called with negative value it silently returns a nullptr rather than raise an exception. Fix abovementioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc. Add `TestNN.test_adaptive_pooling_size_overflow` to indirecty validate the fix. Fixes #50960 [ghstack-poisoned]
This was referenced Feb 23, 2021
💊 CI failures summary and remediationsAs of commit 9d37713 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
Current code is written with the assumption that `new_size` is unsigned value, and when function is called with negative value it silently returns a nullptr rather than raise an exception. Fix abovementioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc. Add `TestNN.test_adaptive_pooling_size_overflow` to indirecty validate the fix. Fixes #50960 Differential Revision: [D26607549](https://our.internmc.facebook.com/intern/diff/D26607549) [ghstack-poisoned]
walterddr
approved these changes
Feb 23, 2021
mruberry
reviewed
Feb 23, 2021
Current code is written with the assumption that `new_size` is unsigned value, and when function is called with negative value it silently returns a nullptr rather than raise an exception. Fix abovementioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc. Add `TestNN.test_adaptive_pooling_size_overflow` to indirecty validate the fix. Fixes #50960 Differential Revision: [D26607549](https://our.internmc.facebook.com/intern/diff/D26607549) [ghstack-poisoned]
Code is written with the assumption that `new_size` is unsigned value, and when function is called with negative value it silently returns a nullptr rather than raise an exception. Fix abovementioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc. Unroll nested if blocks by returning early if `new_size` is 0 Add `TestNN.test_adaptive_pooling_size_overflow` to indirecty validate the fix. Fixes #50960 Differential Revision: [D26607549](https://our.internmc.facebook.com/intern/diff/D26607549) [ghstack-poisoned]
malfet
changed the title
Change Feb 24, 2021
maybe_resize_storage_cpu
to error on negative numbersmaybe_resize_storage_cpu
new_size
arg to unsigned
aocsa
pushed a commit
to Quansight/pytorch
that referenced
this pull request
Mar 15, 2021
…#52671) Summary: Pull Request resolved: pytorch#52671 Code is written with the assumption that new_size is unsigned value, and when function is called with negative value it silently returns a nullptr rather than raise an exception. Fix above-mentioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc. Unroll nested if blocks by returning early if new_size is 0 Add TestNN.test_adaptive_pooling_size_overflow to indirecty validate the fix. Fixes pytorch#50960 Test Plan: Imported from OSS Reviewed By: walterddr Differential Revision: D26607549 Pulled By: malfet fbshipit-source-id: e3d4f7548b098f24fa5aba42d8f4e9288ece1e2e
xsacha
pushed a commit
to xsacha/pytorch
that referenced
this pull request
Mar 31, 2021
…#52671) Summary: Pull Request resolved: pytorch#52671 Code is written with the assumption that new_size is unsigned value, and when function is called with negative value it silently returns a nullptr rather than raise an exception. Fix above-mentioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc. Unroll nested if blocks by returning early if new_size is 0 Add TestNN.test_adaptive_pooling_size_overflow to indirecty validate the fix. Fixes pytorch#50960 Test Plan: Imported from OSS Reviewed By: walterddr Differential Revision: D26607549 Pulled By: malfet fbshipit-source-id: e3d4f7548b098f24fa5aba42d8f4e9288ece1e2e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
maybe_resize_storage_cuda
new_size argument should be unsigned #52672maybe_resize_storage_cuda
new_size argument should be unsignedmaybe_resize_storage_cpu
new_size
arg to unsigned #52671 Changemaybe_resize_storage_cpu
new_size
arg to unsignedCode is written with the assumption that
new_size
is unsigned value,and when function is called with negative value it silently returns a nullptr rather than raise an exception.
Fix abovementioned logic by converting new_size to unsigned type and let cpu_allocator raise exception on negative alloc.
Unroll nested if blocks by returning early if
new_size
is 0Add
TestNN.test_adaptive_pooling_size_overflow
to indirecty validate the fix.Fixes #50960
Differential Revision: D26607549