From f918c49bfdf3a5101484c451e3dbffb7663fa6c3 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 8 Apr 2016 13:48:33 +0200 Subject: [PATCH] Accessing an element of table before determining size issue resolved --- lib/libZRCola/src/translate.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/libZRCola/src/translate.cpp b/lib/libZRCola/src/translate.cpp index 9f2619f..12d4e60 100644 --- a/lib/libZRCola/src/translate.cpp +++ b/lib/libZRCola/src/translate.cpp @@ -80,10 +80,9 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input if (l >= r) { // The search area is empty. - const translation &trans = idxComp[l_prev]; - if (j && l_prev < compositionsCount && j == trans.str_len) { + if (j && l_prev < compositionsCount && j == idxComp[l_prev].str_len) { // The first composition of the previous run was a match. - output += trans.chr; + output += idxComp[l_prev].chr; i = ii; if (j > 1 && map) { // Mapping changed. @@ -99,10 +98,9 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input } else { // End of input reached. - const translation &trans = idxComp[l]; - if (l < compositionsCount && j == trans.str_len) { + if (l < compositionsCount && j == idxComp[l].str_len) { // The first composition of the previous run was a match. - output += trans.chr; + output += idxComp[l].chr; i = ii; if (j > 1 && map) { // Mapping changed.