[liblouis-liblouisxml] [liblouis] r844 committed - Fix some valgrind warnings about invalid reads, i.e. do some array...

  • From: liblouis@xxxxxxxxxxxxxx
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 03 Dec 2012 16:34:51 +0000

Revision: 844
Author:   christian.egli@xxxxxxxxxxxxxx
Date:     Mon Dec  3 08:29:45 2012
Log:      Fix some valgrind warnings about invalid reads, i.e. do some array
bound checking.

http://code.google.com/p/liblouis/source/detail?r=844

Modified:
 /trunk/ChangeLog
 /trunk/liblouis/lou_translateString.c

=======================================
--- /trunk/ChangeLog    Mon Dec  3 07:49:00 2012
+++ /trunk/ChangeLog    Mon Dec  3 08:29:45 2012
@@ -1,3 +1,9 @@
+2012-12-03  Christian Egli  <christian.egli@xxxxxx>
+
+       * liblouis/lou_translateString.c (lou_dotsToChar): Fix some
+       valgrind warnings about invalid reads, i.e. do some array bound
+       checking.
+
 2012-12-03  Joseph Lee <joseph.lee22590@xxxxxxxxx>

        * tables/Makefile.am (table_files):
=======================================
--- /trunk/liblouis/lou_translateString.c       Thu Nov  1 18:35:08 2012
+++ /trunk/liblouis/lou_translateString.c       Mon Dec  3 08:29:45 2012
@@ -701,7 +701,7 @@
 checkMultCaps (void)
 {
   int k;
-  for (k = 0; k < table->lenBeginCaps; k++)
+  for (k = 0; k < table->lenBeginCaps && k < srcmax - src; k++)
     if (!checkAttr (currentInput[src + k], CTC_UpperCase, 0))
       return 0;
   return 1;
@@ -1136,7 +1136,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 +1151,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

Other related posts:

  • » [liblouis-liblouisxml] [liblouis] r844 committed - Fix some valgrind warnings about invalid reads, i.e. do some array... - liblouis