Revision: 867 Author: christian.egli@xxxxxxxxxxxxxx Date: Mon Dec 17 02:47:51 2012Log: Fix the valgrind warnings properly (this time hopefully) without adding a regression
http://code.google.com/p/liblouis/source/detail?r=867 Modified: /trunk/ChangeLog /trunk/NEWS /trunk/liblouis/lou_translateString.c ======================================= --- /trunk/ChangeLog Mon Dec 17 02:26:31 2012 +++ /trunk/ChangeLog Mon Dec 17 02:47:51 2012 @@ -1,3 +1,9 @@ +2012-12-17 Christian Egli <christian.egli@xxxxxx> + + * liblouis/lou_translateString.c (checkMultCaps): + (noCompbrlAhead): Fix the valgrind warnings properly without + adding a regression. + 2012-12-17 Hammer Attila <hammera@xxxxxxxxx> * tests/harnessSources/hu-hu-g1_harness_source.txt: ======================================= --- /trunk/NEWS Mon Dec 17 02:26:31 2012 +++ /trunk/NEWS Mon Dec 17 02:47:51 2012 @@ -10,6 +10,7 @@ - Fix a bug in the correct opcode which causes sometimes random results when translating. Thanks to Bert Frees. - Fixes for compiler warnings. + - Fix some Valgrind warnings about invalid reads ** New features *** New Braille tables ======================================= --- /trunk/liblouis/lou_translateString.c Fri Dec 14 08:24:23 2012 +++ /trunk/liblouis/lou_translateString.c Mon Dec 17 02:47:51 2012 @@ -702,7 +702,8 @@ { int k; for (k = 0; k < table->lenBeginCaps; k++) - if (!checkAttr (currentInput[src + k], CTC_UpperCase, 0)) + if (k >= srcmax - src || + !checkAttr (currentInput[src + k], CTC_UpperCase, 0)) return 0; return 1; } @@ -1136,7 +1137,7 @@ int curSrc; if (start >= srcmax) return 1; - while (checkAttr (currentInput[start], CTC_Space, 0) && start < srcmax) + while (start < srcmax && checkAttr (currentInput[start], CTC_Space, 0)) start++; if (start == srcmax || (transOpcode == CTO_JoinableWord && (!checkAttr (currentInput @@ -1151,7 +1152,7 @@ 0)))) return 1; end = start; - while (!checkAttr (currentInput[end], CTC_Space, 0) && end < srcmax) + while (end < srcmax && !checkAttr (currentInput[end], CTC_Space, 0)) end++; if ((mode & (compbrlAtCursor | compbrlLeftCursor)) && cursorPosition >= start && cursorPosition < end) For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com