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
commit03989754cb2511431e1df6001fca41b3806ad461 (patch)
treec4035fc0e182f92d09e0f7e2d172ab80de658b94 /decoder
parent452a86f3f049bf21a2309f4aeba2a9b9f7144f85 (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) {