[liblouis-liblouisxml] [liblouis] r997 committed - Remove the lang2table feature. ...

  • From: liblouis@xxxxxxxxxxxxxx
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Thu, 06 Jun 2013 07:28:26 +0000

Revision: 997
Author:   christian.egli@xxxxxxxxxxxxxx
Date:     Thu Jun  6 00:28:03 2013
Log:      Remove the lang2table feature.

It was never used, undocumented and contains an out-of-bounds access
bug. This is actually a backport of a bigger change that John did on
the refactor branch.

This change was discussed in
//www.freelists.org/post/liblouis-liblouisxml/PATCH-FW-Outofbounds-access-in-doLang2Table

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

Deleted:
 /trunk/tables/lang2table
Modified:
 /trunk/ChangeLog
 /trunk/NEWS
 /trunk/liblouis/compileTranslationTable.c
 /trunk/tables/Makefile.am

=======================================
--- /trunk/tables/lang2table    Wed May 30 10:11:20 2012
+++ /dev/null
@@ -1,18 +0,0 @@
-# This file finds translation tables based on language codes, country
-# codes, or whatever.
-# You can change it according to your own preferences.
-# See the liblouis documentation for more information.
-
-cy cy-cy-g2.ctb
-da da-dk-g2.ctb
-ch de-ch-g2.ctb
-de de-de-g2.ctb
-# de-g2-core.ctb
-gb en-GB-g2.ctb
-us en-us-g2.ctb
-fr fr-bfu-g2.ctb
-# Fr-Ca-g2.ctb
-# Fr-Fr-g2.ctb
-no no-no-g2.ctb
-pt pt-pt-g2.ctb
-uebc UEBC-g2.ctb
=======================================
--- /trunk/ChangeLog    Mon Jun  3 05:25:19 2013
+++ /trunk/ChangeLog    Thu Jun  6 00:28:03 2013
@@ -1,3 +1,12 @@
+2013-06-06  Christian Egli  <christian.egli@xxxxxx>
+
+       * tables/Makefile.am (table_files):
+       * liblouis/compileTranslationTable.c (doLang2table):
+       (compileTranslationTable): Remove the lang2table feature. It was
+       never used, undocumented and contains an out-of-bounds access bug.
+       See also
+ //www.freelists.org/post/liblouis-liblouisxml/PATCH-FW-Outofbounds-access-in-doLang2Table
+
 2013-06-03  Christian Egli  <christian.egli@xxxxxx>

        * tests/hash_collision.c:
=======================================
--- /trunk/NEWS Mon Jun  3 05:18:57 2013
+++ /trunk/NEWS Thu Jun  6 00:28:03 2013
@@ -60,6 +60,13 @@
    - Fix a bug when resizing a table. Previously not all references to
      this table were updated.

+** Backwards incompatible changes
+   - The feature that allowed a mapping between language code and
+     Braille table was removed as it contained a out-of-bounds access
+     bug, was never documented and probably never used. Thanks to
+     Peter Nilsson Lundblad and Jeremy Roman for analyzing this
+     problem and providing a patch.
+
 * Noteworthy changes in release 2.5.2 (2012-12-18)

 While initially planned as mainly a bug fix release this release
=======================================
--- /trunk/liblouis/compileTranslationTable.c   Mon Jun  3 05:18:57 2013
+++ /trunk/liblouis/compileTranslationTable.c   Thu Jun  6 00:28:03 2013
@@ -4692,71 +4692,11 @@
     table->numPasses = 1;
   return 1;
 }
-
-static char *
-doLang2table (const char *tableList)
-{
-  static char newList[MAXSTRING];
-  int k;
-  char buffer[MAXSTRING];
-  FILE *l2t;
-  char *langCode;
-  int langCodeLen;
-  if (tableList == NULL || *tableList == 0)
-    return NULL;
-  strcpy (newList, tableList);
-  for (k = strlen (newList) - 1; k >= 0 && newList[k] != '='; k--);
-  if (newList[k] != '=')
-    return newList;
-  fileCount = 1;
-  errorCount = 1;
-  newList[k] = 0;
-  strcpy (buffer, newList);
-  langCode = &newList[k + 1];
-  langCodeLen = strlen (langCode);
-  strcat (buffer, "lang2table");
-  l2t = fopen (buffer, "r");
-  if (l2t == NULL)
-    return NULL;
-  while ((fgets (buffer, sizeof (buffer) - 2, l2t)))
-    {
-      char *codeInFile;
-      int codeInFileLen;
-      char *tableInFile;
-      for (k = 0; buffer[k] < 32; k++);
-      if (buffer[k] == '#' || buffer[k] < 32)
-       continue;
-      codeInFile = &buffer[k];
-      codeInFileLen = k;
-      while (buffer[k] > 32)
-       k++;
-      codeInFileLen = k - codeInFileLen;
-      codeInFile[codeInFileLen] = 0;
-      if (!
-         (codeInFileLen == langCodeLen
-          && strcasecmp (langCode, codeInFile) == 0))
-       continue;
-      while (buffer[k] < 32)
-       k++;
-      tableInFile = &buffer[k];
-      while (buffer[k] > 32)
-       k++;
-      buffer[k] = 0;
-      strcat (newList, tableInFile);
-      fclose (l2t);
-      fileCount = 0;
-      errorCount = 0;
-      return newList;
-    }
-  fclose (l2t);
-  return NULL;
-}

 static void *
-compileTranslationTable (const char *tl)
+compileTranslationTable (const char *tableList)
 {
 /*compile source tables into a table in memory */
-  const char *tableList;
   int k;
   char mainTable[MAXSTRING];
   char subTable[MAXSTRING];
@@ -4768,7 +4708,6 @@
   table = NULL;
   characterClasses = NULL;
   ruleNames = NULL;
-  tableList = doLang2table (tl);
   if (tableList == NULL)
     return NULL;
   if (!opcodeLengths[0])
=======================================
--- /trunk/tables/Makefile.am   Sun Apr 21 05:44:32 2013
+++ /trunk/tables/Makefile.am   Thu Jun  6 00:28:03 2013
@@ -147,7 +147,6 @@
        ko-g2.ctb \
        kok.ctb \
        kru.ctb \
-       lang2table \
        latinLetterDef6Dots.uti \
        latinLetterDef8Dots.uti \
        litdigits6Dots.uti \
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] r997 committed - Remove the lang2table feature. ... - liblouis