1 Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
2 Date: 2018-05-02
3 Initial Package Version: 20180414
4 Upstream Status: Applied
5 Origin: Upstream
6 Description: Three fixes, cherry-picked from svn.
7
8 r47469 Fix segfault in dvipdfm-x (XeTeX) on 1/2/4-bit transparent indexed PNGs.
9
10 r47470 Support poppler-0.64.0 (this one is critical for current BLFS).
11
12 r47477 Fix a ptex regression for discontinuous kinsoku table.
13
14 NB most updates in current svn are for ongoing development.
15
16 I have ignored r47476 (m-tx-0.63a) because the announcement at CTAN says this is
17 a minor correction which will not be moticed on most architectures.
18
19 diff -Naur a/texk/dvipdfm-x/pngimage.c b/texk/dvipdfm-x/pngimage.c
20 --- a/texk/dvipdfm-x/pngimage.c 2018-02-17 08:41:35.000000000 +0000
21 +++ b/texk/dvipdfm-x/pngimage.c 2018-04-30 16:30:00.495894146 +0100
22 @@ -964,12 +964,16 @@
23 png_bytep trans;
24 int num_trans;
25 png_uint_32 i;
26 + png_byte bpc, mask, shift;
27
28 if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ||
29 !png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)) {
30 WARN("%s: PNG does not have valid tRNS chunk but tRNS is requested.", PNG_DEBUG_STR);
31 return NULL;
32 }
33 + bpc = png_get_bit_depth(png_ptr, info_ptr);
34 + mask = 0xff >> (8 - bpc);
35 + shift = 8 - bpc;
36
37 smask = pdf_new_stream(STREAM_COMPRESS);
38 dict = pdf_stream_dict(smask);
39 @@ -981,7 +985,8 @@
40 pdf_add_dict(dict, pdf_new_name("ColorSpace"), pdf_new_name("DeviceGray"));
41 pdf_add_dict(dict, pdf_new_name("BitsPerComponent"), pdf_new_number(8));
42 for (i = 0; i < width*height; i++) {
43 - png_byte idx = image_data_ptr[i];
44 + /* data is packed for 1/2/4 bpc formats, msb first */
45 + png_byte idx = (image_data_ptr[bpc * i / 8] >> (shift - bpc * i % 8)) & mask;
46 smask_data_ptr[i] = (idx < num_trans) ? trans[idx] : 0xff;
47 }
48 pdf_add_stream(smask, (char *)smask_data_ptr, width*height);
49 diff -Naur a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
50 --- a/texk/web2c/luatexdir/image/pdftoepdf.w 2018-01-17 18:00:12.000000000 +0000
51 +++ b/texk/web2c/luatexdir/image/pdftoepdf.w 2018-04-30 16:29:12.201899987 +0100
52 @@ -472,10 +472,10 @@
53 break;
54 */
55 case objString:
56 - copyString(pdf, obj->getString());
57 + copyString(pdf, (GooString *)obj->getString());
58 break;
59 case objName:
60 - copyName(pdf, obj->getName());
61 + copyName(pdf, (char *)obj->getName());
62 break;
63 case objNull:
64 pdf_add_null(pdf);
65 diff -Naur a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
66 --- a/texk/web2c/luatexdir/lua/lepdflib.cc 2018-02-14 14:44:38.000000000 +0000
67 +++ b/texk/web2c/luatexdir/lua/lepdflib.cc 2018-04-30 16:29:17.889917722 +0100
68 @@ -674,7 +674,7 @@
69 uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
70 if (uin->pd != NULL && uin->pd->pc != uin->pc) \
71 pdfdoc_changed_error(L); \
72 - gs = ((in *) uin->d)->function(); \
73 + gs = (GooString *)((in *) uin->d)->function(); \
74 if (gs != NULL) \
75 lua_pushlstring(L, gs->getCString(), gs->getLength()); \
76 else \
77 @@ -1813,7 +1813,7 @@
78 if (uin->pd != NULL && uin->pd->pc != uin->pc)
79 pdfdoc_changed_error(L);
80 if (((Object *) uin->d)->isString()) {
81 - gs = ((Object *) uin->d)->getString();
82 + gs = (GooString *)((Object *) uin->d)->getString();
83 lua_pushlstring(L, gs->getCString(), gs->getLength());
84 } else
85 lua_pushnil(L);
86 diff -Naur a/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc b/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc
87 --- a/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc 2018-04-04 05:08:11.000000000 +0100
88 +++ b/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc 2018-04-30 16:29:35.849907790 +0100
89 @@ -290,7 +290,7 @@
90 static void copyDictEntry(Object * obj, int i)
91 {
92 Object obj1;
93 - copyName(obj->dictGetKey(i));
94 + copyName((char *)obj->dictGetKey(i));
95 pdf_puts(" ");
96 obj1 = obj->dictGetValNF(i);
97 copyObject(&obj1);
98 @@ -355,7 +355,7 @@
99 if (!procset.isName())
100 pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
101 procset.getTypeName());
102 - copyName(procset.getName());
103 + copyName((char *)procset.getName());
104 pdf_puts(" ");
105 }
106 pdf_puts("]\n");
107 @@ -418,7 +418,7 @@
108 && fontdescRef.isRef()
109 && fontdesc.isDict()
110 && embeddableFont(&fontdesc)
111 - && (fontmap = lookup_fontmap(basefont.getName())) != NULL) {
112 + && (fontmap = lookup_fontmap((char *)basefont.getName())) != NULL) {
113 // round /StemV value, since the PDF input is a float
114 // (see Font Descriptors in PDF reference), but we only store an
115 // integer, since we don't want to change the struct.
116 @@ -427,7 +427,7 @@
117 charset = fontdesc.dictLookup("CharSet");
118 if (!charset.isNull() &&
119 charset.isString() && is_subsetable(fontmap))
120 - epdf_mark_glyphs(fd, charset.getString()->getCString());
121 + epdf_mark_glyphs(fd, (char *)charset.getString()->getCString());
122 else
123 embed_whole_font(fd);
124 addFontDesc(fontdescRef.getRef(), fd);
125 @@ -456,7 +456,7 @@
126 if (fontRef.isRef())
127 copyFont(obj->dictGetKey(i), &fontRef);
128 else if (fontRef.isDict()) { // some programs generate pdf with embedded font object
129 - copyName(obj->dictGetKey(i));
130 + copyName((char *)obj->dictGetKey(i));
131 pdf_puts(" ");
132 copyObject(&fontRef);
133 }
134 @@ -565,7 +565,7 @@
135 } else if (obj->isNum()) {
136 pdf_printf("%s", convertNumToPDF(obj->getNum()));
137 } else if (obj->isString()) {
138 - s = obj->getString();
139 + s = (GooString *)obj->getString();
140 p = s->getCString();
141 l = s->getLength();
142 if (strlen(p) == (unsigned int) l) {
143 @@ -589,7 +589,7 @@
144 pdf_puts(">");
145 }
146 } else if (obj->isName()) {
147 - copyName(obj->getName());
148 + copyName((char *)obj->getName());
149 } else if (obj->isNull()) {
150 pdf_puts("null");
151 } else if (obj->isArray()) {
152 diff -Naur a/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc b/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc
153 --- a/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc 2017-10-17 22:52:13.000000000 +0100
154 +++ b/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc 2018-04-30 16:29:41.360904749 +0100
155 @@ -109,7 +109,7 @@
156 fprintf(stderr, "No SourceName found\n");
157 exit(1);
158 }
159 - outname = srcName.getString()->getCString();
160 + outname = (char *)srcName.getString()->getCString();
161 // We cannot free srcName, as objname shares its string.
162 // srcName.free();
163 } else if (objnum > 0) {
164 diff -Naur a/texk/web2c/ptexdir/ptex_version.h b/texk/web2c/ptexdir/ptex_version.h
165 --- a/texk/web2c/ptexdir/ptex_version.h 2018-01-21 03:48:06.000000000 +0000
166 +++ b/texk/web2c/ptexdir/ptex_version.h 2018-04-30 16:27:55.978626503 +0100
167 @@ -1 +1 @@
168 -#define PTEX_VERSION "p3.8.0"
169 +#define PTEX_VERSION "p3.8.1"
170 diff -Naur a/texk/web2c/ptexdir/tests/free_ixsp.tex b/texk/web2c/ptexdir/tests/free_ixsp.tex
171 --- a/texk/web2c/ptexdir/tests/free_ixsp.tex 1970-01-01 01:00:00.000000000 +0100
172 +++ b/texk/web2c/ptexdir/tests/free_ixsp.tex 2018-04-30 16:13:49.260128806 +0100
173 @@ -0,0 +1,53 @@
174 +%#!eptex -ini -etex
175 +\let\dump\relax
176 +\batchmode
177 +\input plain
178 +
179 +\errorstopmode
180 +\catcode`@=11
181 +\newcount\@tempcnta
182 +\newcount\@tempcntb
183 +\newcount\@tempcntc
184 +\mathchardef\LIM=256
185 +
186 +\def\MYCHAR#1{%
187 + \@tempcntc=\numexpr7*#1+"101\relax
188 + \@tempcnta=\@tempcntc\divide\@tempcnta 94
189 + \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
190 + \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
191 + \advance\@tempcnta18 % 18区以降
192 + \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
193 +}
194 +
195 +\newcount\CNT\newcount\CNTA
196 +\CNT=0
197 +\loop
198 + \MYCHAR\CNT
199 + \message{\the\CNT.}
200 + \inhibitxspcode\CNTA=1\relax
201 + \advance\CNT1\relax
202 + \ifnum\CNT<\LIM
203 +\repeat
204 +
205 +\newcount\CNTB
206 +
207 +\loop
208 + \MYCHAR\CNTB
209 + \global\inhibitxspcode\CNTA=3
210 +{%
211 +\CNT=0
212 +\loop
213 + \MYCHAR\CNT
214 + \count@=\numexpr 1-\inhibitxspcode\CNTA\relax
215 + \ifnum\count@=0\else\ifnum\CNTB=\CNT\else
216 + \errmessage{<\the\CNTB, \the\CNT, \the\inhibitxspcode\CNTA>}\fi\fi
217 + \advance\CNT1\relax
218 + \ifnum\CNT<\LIM
219 +\repeat
220 +}
221 + \MYCHAR\CNTB
222 + \global\inhibitxspcode\CNTA=1\relax
223 + \advance\CNTB1\relax
224 + \ifnum\CNTB<\LIM
225 +\repeat
226 +\bye
227 diff -Naur a/texk/web2c/ptexdir/tests/free_pena.tex b/texk/web2c/ptexdir/tests/free_pena.tex
228 --- a/texk/web2c/ptexdir/tests/free_pena.tex 1970-01-01 01:00:00.000000000 +0100
229 +++ b/texk/web2c/ptexdir/tests/free_pena.tex 2018-04-30 16:15:00.829396672 +0100
230 @@ -0,0 +1,52 @@
231 +%#!eptex -ini -etex
232 +\let\dump\relax
233 +\batchmode
234 +\input plain
235 +
236 +\errorstopmode
237 +\catcode`@=11
238 +\newcount\@tempcnta
239 +\newcount\@tempcntb
240 +\newcount\@tempcntc
241 +\mathchardef\LIM=256
242 +
243 +\def\MYCHAR#1{%
244 + \@tempcntc=\numexpr7*#1+"101\relax
245 + \@tempcnta=\@tempcntc\divide\@tempcnta 94
246 + \@tempcntb=\numexpr\@tempcntc-94*\@tempcnta+1\relax
247 + \ifnum\@tempcntb<0\advance\@tempcntb94 \advance\@tempcnta-1\fi
248 + \advance\@tempcnta18 % 18区以降
249 + \CNTA=\kuten\numexpr"100*\@tempcnta+\@tempcntb\relax
250 +}
251 +
252 +\newcount\CNT\newcount\CNTA
253 +\CNT=0
254 +\loop
255 + \MYCHAR\CNT
256 + \message{\the\CNT.}
257 + \prebreakpenalty\CNTA=\numexpr\CNT+1\relax
258 + \advance\CNT1\relax
259 + \ifnum\CNT<\LIM
260 +\repeat
261 +
262 +\newcount\CNTB
263 +
264 +\loop
265 + \MYCHAR\CNTB
266 + \global\prebreakpenalty\CNTA=0
267 +{%
268 +\CNT=0
269 +\loop
270 + \MYCHAR\CNT
271 + \count@=\numexpr -\CNT-1+\prebreakpenalty\CNTA\relax
272 + \ifnum\count@=0\else\ifnum\CNTB=\CNT\else\errmessage{<\the\CNTB, \the\CNT>}\fi\fi
273 + \advance\CNT1\relax
274 + \ifnum\CNT<\LIM
275 +\repeat
276 +}
277 + \MYCHAR\CNTB
278 + \global\prebreakpenalty\CNTA=\numexpr\CNTB+1\relax
279 + \advance\CNTB1\relax
280 + \ifnum\CNTB<\LIM
281 +\repeat
282 +\bye
|