8000 Add indices checking for parameters in model.cc by Dim131 · Pull Request #1593 · clab/dynet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add indices checking for parameters in model.cc #1593

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

Merged
merged 1 commit into from
Jan 17, 2021
Merged

Conversation

Dim131
Copy link
Contributor
@Dim131 Dim131 commented Oct 14, 2019

Currently, there is no index checking in gradient_l2_norm_dev and sometimes it could access elements beyond the end of the vector (when k1 = params.size() or k2 = lookup_params.size()).

To fix this, we introduce a simple bounds check.
params.size() > k1
lookup_params.size() > k2

Currently, there is no indices checking in gradient_l2_norm_dev and sometimes the code could request elements beyond the end of the vector (when k1 = params.size() or k2 = lookup_params.size()).

To fix this, we introduce a simple bounds check.
 params.size() >
8000
; k1
 lookup_params.size() > k2
@kwalcock
Copy link
Contributor

I was about to make a PR to fix this exact same problem. It would have saved me a lot of time had this been merged a year ago.

@neubig neubig merged commit ef1190d into clab:master Jan 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0