Skip to content
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

Prevent an OOB read in expand_dims.cc #51322

Merged

Conversation

mihaimaruseac
Copy link
Collaborator

The for loop that follows this check assumes that axis is between 0 and input_dims.size. If user supplied axis is negative, the if code before this check is supposed to bring it back to positive (similar to how in Python one can do l[-3] to mean l[-3 + len(l)]).

PiperOrigin-RevId: 387200206
Change-Id: I162f4feba12d547c3a4340833ae682016a2ebfab

The for loop that follows this check assumes that `axis` is between `0` and `input_dims.size`. If user supplied `axis` is negative, the if code before this check is supposed to bring it back to positive (similar to how in Python one can do `l[-3]` to mean `l[-3 + len(l)]`).

PiperOrigin-RevId: 387200206
Change-Id: I162f4feba12d547c3a4340833ae682016a2ebfab
@google-cla google-cla bot added the cla: yes label Aug 5, 2021
@mihaimaruseac mihaimaruseac merged commit 5133048 into r2.3 Aug 6, 2021
@mihaimaruseac mihaimaruseac deleted the mm-cp-d94ffe08a65400f898241c0374e9edc6fa8ed257-on-r2.3 branch August 6, 2021 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant