summaryrefslogtreecommitdiff
path: root/office/texlive/patches/texlive-20160523b-source-upstream_fixes-1.patch
blob: 2dc07f4078bcf2cdb959b5bccc4fd4ce64b1fd9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2016-06-25
Initial Package Version: 20160523
Upstream Status: Applied
Origin: Upstream, svn revisions 41497, 41498
Description: Fixes segfault in upmendex.

diff -Naur texlive-20160523-source/texk/README texlive-20160523-source-b/texk/README
--- texlive-20160523-source/texk/README	2016-04-20 00:51:42.000000000 +0100
+++ texlive-20160523-source-b/texk/README	2016-06-24 05:02:26.519423562 +0100
@@ -98,7 +98,7 @@
 
 ttfdump - ?
 
-upmendex 0.50 - 
+upmendex 0.51 - by Takuji Tanaka
   http://www.ctan.org/pkg/upmendex
   http://www.t-lab.opal.ne.jp/tex/uptex_en.html
 
diff -Naur texlive-20160523-source/texk/upmendex/ChangeLog texlive-20160523-source-b/texk/upmendex/ChangeLog
--- texlive-20160523-source/texk/upmendex/ChangeLog	2016-02-12 16:05:18.000000000 +0000
+++ texlive-20160523-source-b/texk/upmendex/ChangeLog	2016-06-24 05:02:26.519423562 +0100
@@ -1,3 +1,9 @@
+2016-06-19  TANAKA Takuji  <ttk@t-lab.opal.ne.jp>
+
+	* version 0.51  Beta version.
+	* fwrite.c: Fix bug of option "hanzi_head" in style file.
+	Thanks to Dr. Werner Fink.
+
 2016-02-12  Karl Berry  <karl@tug.org>
 
 	* configure.ac (KPSE_CXX_HACK): add to avoid usual libstdc++.so
diff -Naur texlive-20160523-source/texk/upmendex/fwrite.c texlive-20160523-source-b/texk/upmendex/fwrite.c
--- texlive-20160523-source/texk/upmendex/fwrite.c	2016-02-09 11:02:48.000000000 +0000
+++ texlive-20160523-source-b/texk/upmendex/fwrite.c	2016-06-24 05:02:26.519423562 +0100
@@ -67,33 +67,38 @@
 
 static void fprint_uchar(FILE *fp, const UChar *a, const int mode, const int len)
 {
-	int k;
-	char str[15], *ret;
-	UChar istr[5];
+	char str[3*INITIALLENGTH+1];
+	UChar istr[INITIALLENGTH];
 	int olen, wclen;
 	UErrorCode perr;
 
 	if (len<0) {
-		for (k=0; a[k] || k<4; k++) istr[k]=a[k];
-		wclen=k;
+		u_strcpy(istr,a);
+		wclen=u_strlen(istr);
 	} else {
-		wclen = is_surrogate_pair(a) ? 2 : 1;
+		wclen=is_surrogate_pair(a) ? 2 : 1;
 			      istr[0]=a[0];
 		if (wclen==2) istr[1]=a[1];
+		istr[wclen]=L'\0';
 	}
-	istr[wclen]=L'\0';
 	if (mode==M_TO_UPPER) {
-		perr = U_ZERO_ERROR;
-		u_strToUpper(istr,5,istr,wclen,"",&perr);
+		perr=U_ZERO_ERROR;
+		olen=u_strToUpper(istr,INITIALLENGTH,istr,wclen,"",&perr);
 	} else if (mode==M_TO_LOWER) {
-		perr = U_ZERO_ERROR;
-		u_strToLower(istr,5,istr,wclen, istr[0]==0x130&&turkish_i?"tr":"", &perr);
+		perr=U_ZERO_ERROR;
+		olen=u_strToLower(istr,INITIALLENGTH,istr,wclen, istr[0]==0x130&&turkish_i?"tr":"", &perr);
 	} else if (mode==M_TO_TITLE) {
-		perr = U_ZERO_ERROR;
-		u_strToTitle(istr,5,istr,wclen,NULL,"",&perr);
-	}
-	perr = U_ZERO_ERROR;
-	ret = u_strToUTF8(str, 15, &olen, istr, wclen, &perr);
+		perr=U_ZERO_ERROR;
+		olen=u_strToTitle(istr,INITIALLENGTH,istr,wclen,NULL,"",&perr);
+	} else
+		olen=wclen;
+	if (olen>INITIALLENGTH) {
+		warn_printf(efp, "\nWarning, Too long (%d) header.\n", olen);
+		wclen=INITIALLENGTH;
+	} else
+		wclen=olen;
+	perr=U_ZERO_ERROR;
+	u_strToUTF8(str, 3*INITIALLENGTH+1, &olen, istr, wclen, &perr);
 	fprintf(fp,"%s",str);
 }
 
@@ -844,7 +849,7 @@
 static int init_hanzi_header(void)
 {
 	UChar strX[2],*pch0,*pch1;
-	int k, hzmode;
+	int k, hzmode, len;
 	struct hanzi_index *hz_idx_init;
 
 	strX[0]=0x5B57;  strX[1]=L'\0';
@@ -878,21 +883,18 @@
 	for (k=0;k<hz_index_len;k++) {
 		if (u_strlen(pch0)==0) break;
 		if ((pch1=u_strchr(pch0,L';'))>0) {
-			if (pch1-pch0>=INITIALLENGTH) {
-				warn_printf(efp, "\nWarning, Too long hanzi header.\n");
-				break;
-			}
-			u_strncpy(hz_index[k].idx,pch0,pch1-pch0);
-			hz_index[k].idx[pch1-pch0]=L'\0';
-			pch0=pch1+1;
+			len=pch1-pch0;
 		} else {
-			if (u_strlen(pch0)>=INITIALLENGTH) {
-				warn_printf(efp, "\nWarning, Too long hanzi header.\n");
-				break;
-			}
-			u_strcpy(hz_index[k].idx,pch0);
-			break;
+			len=u_strlen(pch0);
 		}
+		if (len>=INITIALLENGTH) {
+			warn_printf(efp, "\nWarning, Too long (%d) hanzi header.\n", len);
+			len=INITIALLENGTH-1;
+		}
+		u_strncpy(hz_index[k].idx,pch0,len);
+		hz_index[k].idx[len]=L'\0';
+		if (pch1>0) pch0=pch1+1;
+		else break;
 	}
 
 	return hzmode;
diff -Naur texlive-20160523-source/texk/upmendex/main.c texlive-20160523-source-b/texk/upmendex/main.c
--- texlive-20160523-source/texk/upmendex/main.c	2016-02-09 23:44:45.000000000 +0000
+++ texlive-20160523-source-b/texk/upmendex/main.c	2016-06-24 05:02:26.519423562 +0100
@@ -19,7 +19,7 @@
 #endif
 KpathseaSupportInfo kp_ist,kp_dict;
 
-#define VERSION "version 0.50"
+#define VERSION "version 0.51"
 
 int main(int argc, char **argv)
 {