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

[MXNET-969] Fix buffer overflow in RNNOp #12603

Merged
merged 2 commits into from
Sep 21, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
KellenSunderland marked this conversation as resolved.
Show resolved Hide resolved
param_.p,
param_.mode);
}
Expand Down