From 925af5c9e4ffc92a42a443ae6b3da83895e66133 Mon Sep 17 00:00:00 2001 From: ilor <kailoran@gmail.com> Date: Tue, 30 Nov 2010 14:38:09 +0100 Subject: [PATCH] fix SentenceContext::at(int) UB due to wrong check being done --- libwccl/sentencecontext.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libwccl/sentencecontext.h b/libwccl/sentencecontext.h index 6ff68a3..7451d78 100644 --- a/libwccl/sentencecontext.h +++ b/libwccl/sentencecontext.h @@ -75,7 +75,7 @@ public: /// Token access convenience function - const. /// Will return NULL if the passed position is not valid in this Sentence const Corpus2::Token* at(int abs_pos) const { - if (is_current_inside()) { + if (is_inside(abs_pos)) { return get_sentence()[abs_pos]; } else { return NULL; @@ -90,7 +90,7 @@ public: /// Token access convenience function. /// Will return NULL if the passed position is not valid in this Sentence Corpus2::Token* at(int abs_pos) { - if (is_current_inside()) { + if (is_inside(abs_pos)) { return get_sentence()[abs_pos]; } else { return NULL; -- GitLab