Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[MXNET-969] Fix buffer overflow in RNNOp
Browse files Browse the repository at this point in the history
Co-authored-by: Sina Md <[email protected]>
  • Loading branch information
KellenSunderland and Sina Md committed Sep 19, 2018
1 parent ce6525a commit 7e91550
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/operator/rnn-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,13 @@ class RNNOp : public Operator{
}

DType* reserve_space_ptr = static_cast<DType*>(reserve_space_.dptr);

int req_statecell = 0;
if (param_.mode == rnn_enum::kLstm) {
// State cell should be present for LSTMs.
req_statecell = req[rnn_enum::kStateCell];
}

RNNBackward<DType>(workspace.dptr_,
reserve_space_ptr,
param_.num_layers,
Expand All @@ -576,7 +583,7 @@ class RNNOp : public Operator{
req[rnn_enum::kData],
req[rnn_enum::kParams],
req[rnn_enum::kState],
req[rnn_enum::kStateCell],
req_statecell,
param_.p,
param_.mode);
}
Expand Down

0 comments on commit 7e91550

Please sign in to comment.