]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - tiesr-gforge/tiesr-gforge.git/commitdiff
[#1417] Add maximum limit to number of allowable phones. This limits the number of...
authorlnetsch <lnetsch@localhost>
Fri, 11 Nov 2011 17:20:47 +0000 (17:20 +0000)
committerlnetsch <lnetsch@localhost>
Fri, 11 Nov 2011 17:20:47 +0000 (17:20 +0000)
TIesr_Tools/dictproc/src/compress_entry.c
TIesr_Tools/dictproc/src/dictproc.h

index e6b1eb66f3611a33c67c1c65afedb034f0a5fc3c..77e042a62d5ff5406cbda30ebd2e956fe61eab49 100755 (executable)
@@ -114,6 +114,11 @@ void read_phone( char *fname )
       exit(1);
   }
   while ( fgets(buf, MAX_STR, fp) ) {
+    if( n_phone >= MAX_PHONE )
+    {
+      fprintf( stderr, "Number of phones exceeds MAX_PHONE" );
+      exit(1);
+    }
     ptr = (char *) strtok(buf, DELIMIT);
     phone[ n_phone ] = (char *) strdup( ptr );
     n_phone++;
index baa6547cec1b1718dec90f16af2f0b180a4f9086..2c6bbbe72e8d473f75c29ba20e453fe297fc2977 100644 (file)
 #include   <stdio.h>
 #include   <string.h>
 
-#define    MAX_PHONE    100      /* English has 46 */
+/* TIesr uses bytes for phone indices. The last two indices are for the
+ special boundary phone "sp" and the silence phone, leaving space for
+ 254 (indices 0-253 ) possible phones. */
+#define    MAX_PHONE    254      /* English has ~46 */
+
 #define    MAX_PRON     100      /* max # of phones in a word */
 #define    MAX_ENTRY    300000
 #define    MAX_STR      1024