[Julius-cvs 703] CVS update: julius4/libsent/src/voca

アーカイブの一覧に戻る

sumom****@users***** sumom****@users*****
2011年 7月 11日 (月) 15:46:27 JST


Index: julius4/libsent/src/voca/voca_load_htkdict.c
diff -u julius4/libsent/src/voca/voca_load_htkdict.c:1.10 julius4/libsent/src/voca/voca_load_htkdict.c:1.11
--- julius4/libsent/src/voca/voca_load_htkdict.c:1.10	Fri Apr 29 14:09:20 2011
+++ julius4/libsent/src/voca/voca_load_htkdict.c	Mon Jul 11 15:46:26 2011
@@ -19,7 +19,7 @@
  * @author Akinobu LEE
  * @date   Fri Feb 18 19:43:06 2005
  *
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
  * 
  */
 /*
@@ -62,8 +62,8 @@
 static char buf[MAXLINELEN];	///< Local work area for input text processing
 static char bufbak[MAXLINELEN];	///< Local work area for debug message
 
-static char trbuf[3][20];	///< Local buffer for triphone convertion
-static char chbuf[30];	     ///< Another local buffer for triphone convertion
+static char trbuf[3][MAX_HMMNAME_LEN];	///< Local buffer for triphone convertion
+static char chbuf[MAX_HMMNAME_LEN];	     ///< Another local buffer for triphone convertion
 static char nophone[1];		///< Local buffer to indicate 'no phone'
 static int  trp_l;		///< Triphone cycle index
 static int  trp;		///< Triphone cycle index
@@ -509,6 +509,12 @@
 	*ok_flag = FALSE;
 	return TRUE;
       }
+      if (strlen(lp) >= MAX_HMMNAME_LEN) {
+	jlog("Error: voca_load_htkdict: line %d: too long phone name: %s\n", linenum, lp);
+	winfo->errnum++;
+	*ok_flag = FALSE;
+	return TRUE;
+      }
       cycle_triphone(lp);
     }
 
@@ -517,7 +523,15 @@
       if (do_conv) {
 /*	if (lp != NULL) jlog(" %d%s",len,lp);*/
 	if (lp != NULL) lp = mystrtok(NULL, " \t\n");
-	if (lp != NULL) p = cycle_triphone(lp);
+	if (lp != NULL) {
+	  if (strlen(lp) >= MAX_HMMNAME_LEN) {
+	    jlog("Error: voca_load_htkdict: line %d: too long phone name: %s\n", linenum, lp);
+	    winfo->errnum++;
+	    *ok_flag = FALSE;
+	    return TRUE;
+	  }
+	  p = cycle_triphone(lp);
+	}
 	else p = cycle_triphone_flush();
       } else {
 	p = mystrtok(NULL, " \t\n");
Index: julius4/libsent/src/voca/voca_load_wordlist.c
diff -u julius4/libsent/src/voca/voca_load_wordlist.c:1.6 julius4/libsent/src/voca/voca_load_wordlist.c:1.7
--- julius4/libsent/src/voca/voca_load_wordlist.c:1.6	Fri Apr 29 14:09:20 2011
+++ julius4/libsent/src/voca/voca_load_wordlist.c	Mon Jul 11 15:46:26 2011
@@ -13,7 +13,7 @@
  * @author Akinobu LEE
  * @date   Sun Jul 22 13:29:32 2007
  *
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
  * 
  */
 /*
@@ -325,6 +325,12 @@
 	  cycle_triphone(NULL);
 	  /* insert head phone at beginning of word */
 	  if (contextphone) {
+	    if (strlen(contextphone) >= MAX_HMMNAME_LEN) {
+	      jlog("Error: voca_load_htkdict: line %d: too long phone name: %s\n", linenum, contextphone);
+	      winfo->errnum++;
+	      *ok_flag = FALSE;
+	      return TRUE;
+	    }
 	    cycle_triphone(contextphone);
 	  } else {
 	    cycle_triphone("NULL_C");
@@ -335,6 +341,12 @@
 	    *ok_flag = FALSE;
 	    return TRUE;
 	  }
+	  if (strlen(lp) >= MAX_HMMNAME_LEN) {
+	    jlog("Error: voca_load_htkdict: line %d: too long phone name: %s\n", linenum, lp);
+	    winfo->errnum++;
+	    *ok_flag = FALSE;
+	    return TRUE;
+	  }
 	  p = cycle_triphone(lp);
 	  first = FALSE;
 	} else {		/* do_conv, not first */
@@ -342,10 +354,22 @@
 	    lp = mystrtok(NULL, " \t\n");
 	    if (lp != NULL) {
 	      /* token exist */
+	      if (strlen(lp) >= MAX_HMMNAME_LEN) {
+		jlog("Error: voca_load_htkdict: line %d: too long phone name: %s\n", linenum, lp);
+		winfo->errnum++;
+		*ok_flag = FALSE;
+		return TRUE;
+	      }
 	      p = cycle_triphone(lp);
 	    } else {
 	      /* no more token, insert tail phone at end of word */
 	      if (contextphone) {
+		if (strlen(contextphone) >= MAX_HMMNAME_LEN) {
+		  jlog("Error: voca_load_htkdict: line %d: too long phone name: %s\n", linenum, contextphone);
+		  winfo->errnum++;
+		  *ok_flag = FALSE;
+		  return TRUE;
+		}
 		p = cycle_triphone(contextphone);
 	      } else {
 		p = cycle_triphone("NULL_C");



Julius-cvs メーリングリストの案内
アーカイブの一覧に戻る