Accessing an element of table before determining size issue resolved

This commit is contained in:
Simon Rozman 2016-04-08 13:48:33 +02:00
parent 72c29a692e
commit f918c49bfd

View File

@ -80,10 +80,9 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input
if (l >= r) { if (l >= r) {
// The search area is empty. // The search area is empty.
const translation &trans = idxComp[l_prev]; if (j && l_prev < compositionsCount && j == idxComp[l_prev].str_len) {
if (j && l_prev < compositionsCount && j == trans.str_len) {
// The first composition of the previous run was a match. // The first composition of the previous run was a match.
output += trans.chr; output += idxComp[l_prev].chr;
i = ii; i = ii;
if (j > 1 && map) { if (j > 1 && map) {
// Mapping changed. // Mapping changed.
@ -99,10 +98,9 @@ void ZRCola::translation_db::Compose(_In_z_count_(inputMax) const wchar_t* input
} else { } else {
// End of input reached. // End of input reached.
const translation &trans = idxComp[l]; if (l < compositionsCount && j == idxComp[l].str_len) {
if (l < compositionsCount && j == trans.str_len) {
// The first composition of the previous run was a match. // The first composition of the previous run was a match.
output += trans.chr; output += idxComp[l].chr;
i = ii; i = ii;
if (j > 1 && map) { if (j > 1 && map) {
// Mapping changed. // Mapping changed.