summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorWilker Aziz <will.aziz@gmail.com>2015-02-19 08:52:16 +0000
committerWilker Aziz <will.aziz@gmail.com>2015-02-19 08:52:16 +0000
commit48099f37a36ff3a198c36e881159b14291f8309f (patch)
tree598de467ee2d5c39bef0252bee95a36cd4a1a6bc /decoder
parent0abf34b3bf216b041dab3c338f9ac263d912376c (diff)
when ApplyRules resizes nodes_, the reference to `cat` may become invalid and the parser segfaults (observed with grammars full of unary rules)
Diffstat (limited to 'decoder')
-rw-r--r--decoder/bottom_up_parser.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/decoder/bottom_up_parser.cc b/decoder/bottom_up_parser.cc
index a614b8b3..7ce8e09d 100644
--- a/decoder/bottom_up_parser.cc
+++ b/decoder/bottom_up_parser.cc
@@ -274,7 +274,7 @@ void PassiveChart::ApplyRules(const int i,
void PassiveChart::ApplyUnaryRules(const int i, const int j) {
const vector<int>& nodes = chart_(i,j); // reference is important!
for (unsigned di = 0; di < nodes.size(); ++di) {
- const WordID& cat = forest_->nodes_[nodes[di]].cat_;
+ const WordID cat = forest_->nodes_[nodes[di]].cat_;
for (unsigned ri = 0; ri < unaries_.size(); ++ri) {
//cerr << "At (" << i << "," << j << "): applying " << unaries_[ri]->AsString() << endl;
if (unaries_[ri]->f()[0] == cat) {