amigadave / rpms / liblouis

Forked from rpms/liblouis 2 years ago
Clone
Blob Blame History Raw
From dbfa58bb128cae86729578ac596056b3385817ef Mon Sep 17 00:00:00 2001
From: Christian Egli <christian.egli@sbs.ch>
Date: Wed, 6 Jun 2018 16:41:53 +0200
Subject: [PATCH] Check index before writing to result->chars

Fixes #595

diff --git a/liblouis/compileTranslationTable.c b/liblouis/compileTranslationTable.c
index e3ca96075..c02821214 100644
--- a/liblouis/compileTranslationTable.c
+++ b/liblouis/compileTranslationTable.c
@@ -1127,11 +1127,11 @@ parseChars(FileInfo *nested, CharsString *result, CharsString *token) {
 				}
 				in++;
 			}
-			result->chars[out++] = (widechar)ch;
 			if (out >= MAXSTRING) {
 				result->length = out;
 				return 1;
 			}
+			result->chars[out++] = (widechar)ch;
 			continue;
 		}
 		lastOutSize = out;