curl -RO -C - http://www.ring.gr.jp/pub/text/CTAN/obsolete/systems/unix/teTeX/3.0/distrib/tetex-src-3.0.tar.gz curl -RO -C - http://www.ring.gr.jp/pub/text/CTAN/obsolete/systems/unix/teTeX/3.0/distrib/tetex-texmf-3.0po.tar.gz curl -RO -C - http://tutimura.ath.cx/~nob/tex/ptetex/ptetex3/ptetex3-20090610.tar.gz curl -RO -C - http://tutimura.ath.cx/~nob/tex/ptetex/ptetex-cmap/ptetex-cmap-20090506.tar.gz curl -RO -C - http://project.ktug.or.kr/dvipdfmx/snapshot/latest/dvipdfmx-20100328.tar.gz curl -RO -C - http://oku.edu.mie-u.ac.jp/~okumura/jsclasses/jsclasses-100314.zip tar xvzf ptetex3-20090610.tar.gz tar xvzf ptetex-cmap-20090506.tar.gz (cd ptetex3-20090610/archive && cp -p ../../dvipdfmx-20100328.tar.gz . cat <<'EOF' > ptetex3-ubagami.patch --- ./share/texmf/tex/latex/base/latex.ltx.org 2010-08-31 22:22:32.000000000 +0900 +++ ./share/texmf/tex/latex/base/latex.ltx 2010-08-31 23:53:00.000000000 +0900 @@ -527,17 +527,11 @@ \expandafter\reserved@a\fmtversion\@nil \ifnum\count@>77 \typeout{^^J% -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J% -! You are attempting to make a LaTeX format from a source file^^J% -! That is more than five years old.^^J% -!^^J% -! If you enter to scroll past this message then the format^^J% -! will be built, but please consider obtaining newer source files^^J% -! before continuing to build LaTeX.^^J% -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^J% + You are attempting to make a LaTeX format from a source file^^J% + That is more than six years old.^^J% } - \errhelp{To avoid this error message, obtain new LaTeX sources.} - \errmessage{LaTeX source files more than 5 years old!} + %\errhelp{To avoid this error message, obtain new LaTeX sources.} + %\errmessage{LaTeX source files more than 5 years old!} \fi \let\reserved@a\relax \fi --- ./tetex-src-3.0/texk/dvipdfm/pngimage.c.org 2002-12-26 02:51:16.000000000 +0900 +++ ./tetex-src-3.0/texk/dvipdfm/pngimage.c 2010-09-01 01:21:45.000000000 +0900 @@ -42,7 +42,7 @@ rewind (png_file); if (fread (sigbytes, 1, sizeof(sigbytes), png_file) != sizeof(sigbytes) || - (!png_check_sig (sigbytes, sizeof(sigbytes)))) + (!(png_sig_cmp (sigbytes, 0, sizeof(sigbytes)) == 0))) return 0; else return 1; --- ./tetex-src-3.0/texk/dvipdfm/thumbnail.c.org 2002-12-26 02:51:16.000000000 +0900 +++ ./tetex-src-3.0/texk/dvipdfm/thumbnail.c 2010-09-01 01:21:45.000000000 +0900 @@ -79,7 +79,7 @@ } if (fread (sigbytes, 1, sizeof(sigbytes), thumb_file) != sizeof(sigbytes) || - (!png_check_sig (sigbytes, sizeof(sigbytes)))) { + (!(png_sig_cmp (sigbytes, 0, sizeof(sigbytes)) == 0))) { fprintf (stderr, "\nThumbnail not a png file! Skipping\n"); return NULL; } --- ./tetex-src-3.0/texk/dvipsk/dospecial.c.org 2010-09-01 01:08:29.000000000 +0900 +++ ./tetex-src-3.0/texk/dvipsk/dospecial.c 2010-09-01 01:43:27.000000000 +0900 @@ -412,6 +412,12 @@ static int omega_specials = 0; if (nextstring + numbytes > maxstring) { + if (numbytes < 0 + || (numbytes > 0 && 2 > INT_MAX / numbytes) + || 2 * numbytes > 1000 + 2 * numbytes) { + error("! Integer overflow in predospecial"); + exit(1); + } p = nextstring = mymalloc(1000 + 2 * numbytes) ; maxstring = nextstring + 2 * numbytes + 700 ; } --- ./tetex-src-3.0/texk/dvipsk/virtualfont.c.org 2010-09-01 01:08:29.000000000 +0900 +++ ./tetex-src-3.0/texk/dvipsk/virtualfont.c 2010-09-01 01:43:41.000000000 +0900 @@ -5,6 +5,7 @@ #include "dvips.h" /* The copyright notice in that file is included too! */ #ifdef KPATHSEA #include +#include #endif /* * These are the external routines we use. @@ -36,12 +37,12 @@ * Subroutine vfbyte returns the next byte. */ static FILE *vffile ; -static char name[50] ; +static char name[500] ; void badvf P1C(char *, s) { - (void)sprintf(errbuf,"! Bad VF file %s: %s",name,s) ; - error(errbuf); + char *msg = concatn("! Bad VF file ", name, ":", s); + error(msg); } shalfword @@ -93,6 +94,10 @@ if (*d==0) d = vfpath ; #endif + if (strlen(n) + 5 >= sizeof (name)) { + /* 5 for vf() + null */ + error("! VF file name too long in vfopen") ; + } #ifdef MVSXA /* IBM: MVS/XA */ (void)sprintf(name, "vf(%s)", n) ; #else @@ -223,8 +228,8 @@ k = (integer)(alpha * (real)vfquad()) ; if ((id != 9 && id != 11) && (k > curfnt->designsize + 2 || k < curfnt->designsize - 2)) { - (void)sprintf(errbuf,"Design size mismatch in font %s", name) ; - error(errbuf) ; + char *msg = concat("Design size mismatch in font ", name); + error(msg); } /* * Now we look for font definitions. --- ./tetex-src-3.0/texk/web2c/bibtex.ch.org 2004-07-15 02:32:51.000000000 +0900 +++ ./tetex-src-3.0/texk/web2c/bibtex.ch 2010-09-01 01:43:14.000000000 +0900 @@ -1077,6 +1077,15 @@ @y @z +% Forgot to check for pool overflow here. Triggered by test case linked +% from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520920. +@x +while (sp_ptr < sp_end) do {shift the substring} +@y +str_room(sp_end - sp_ptr); +while (sp_ptr < sp_end) do {shift the substring} +@z + % [459] Eliminate unreferenced statement label, because `undefined' is % now a constant expression that is not evaluated at the Web level. If % this label were ever required, it could be replaced by the constant --- ./tetex-src-3.0/texk/web2c/ptex/jbibtex.ch.org 2010-09-01 01:08:28.000000000 +0900 +++ ./tetex-src-3.0/texk/web2c/ptex/jbibtex.ch 2010-09-01 01:43:56.000000000 +0900 @@ -1381,6 +1381,10 @@ else decr(sp_end); end; +{ Forgot to check for pool overflow here. Triggered by test case linked + from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=520920.} + +str_room(sp_end - sp_ptr); while (sp_ptr < sp_end) do {shift the substring} begin if str_pool[sp_ptr] >127 then begin --- ./tetex-src-3.0/texk/web2c/ptex/ptex-base.ch.org 2010-09-01 01:08:28.000000000 +0900 +++ ./tetex-src-3.0/texk/web2c/ptex/ptex-base.ch 2010-09-01 01:37:04.000000000 +0900 @@ -3524,6 +3524,14 @@ new_noad:=p; @z +@x [34.687] accent with japanese char +@d accent_noad_size=5 {number of |mem| words in an accent noad} +@d accent_chr(#)==#+4 {the |accent_chr| field of an accent noad} +@y +@d accent_noad_size=6 {number of |mem| words in an accent noad} +@d accent_chr(#)==#+5 {the |accent_chr| field of an accent noad} +@z + @x [34.691] l.14236 - pTeX: print_fam_and_char procedure print_fam_and_char(@!p:pointer); {prints family and character} begin print_esc("fam"); print_int(fam(p)); print_char(" "); @@ -3803,7 +3811,7 @@ var a:integer; {address of lig/kern instruction} @!gp,@!gq,@!p,@!r:pointer; {temporary registers for list manipulation} @!rr:halfword; -begin r:=min_halfword; restart:@t@>@;@/ +begin restart:@t@>@;@/ if (math_type(subscr(q))=empty)and(math_type(supscr(q))=empty)and@| ((math_type(nucleus(q))=math_char)or(math_type(nucleus(q))=math_jchar)) then begin p:=link(q); @@ -3843,7 +3851,7 @@ if op_byte(cur_i)null then begin - while((type(gp)<>r)and(link(gp)<>null)) do begin gp:=link(gp); + while((type(gp)<>rr)and(link(gp)<>null)) do begin gp:=link(gp); end; gq:=glue_ptr(gp); end @@ -3851,7 +3859,7 @@ font_glue[cur_f]:=gp; gq:=null; end; if gq=null then - begin type(gp):=r; gq:=new_spec(zero_glue); glue_ptr(gp):=gq; + begin type(gp):=rr; gq:=new_spec(zero_glue); glue_ptr(gp):=gq; a:=exten_base[cur_f]+qi((qo(rr))*3); width(gq):=font_info[a].sc; stretch(gq):=font_info[a+1].sc; shrink(gq):=font_info[a+2].sc; add_glue_ref(gq); link(gp):=get_node(small_node_size); @@ -4487,8 +4495,9 @@ ("\box register that now have a different direction.")@/ ("Proceed, and I'll discard its present contents."); box_error(n) - end; - height(r):=height(box(n))+depth(box(n)); + end + else + height(r):=height(box(n))+depth(box(n)); end; @z @@ -4917,6 +4926,7 @@ @!d:pointer; {last |disp_node|} @!disp,@!pdisp:scaled; {displacement} @!pp,pnode:pointer; +@!f:boolean; {will |d| free?} @z @x [47.1080] l.21636 - pTeX: disp_node, check head=tail @@ -4925,7 +4935,7 @@ @; end; @y -else begin +else begin f:=false; if (not is_char_node(tail))and(type(tail)=disp_node) then begin d:=tail; tail:=prev_node; end @@ -4933,13 +4943,15 @@ if (not is_char_node(tail))and(head<>tail) then if (type(tail)=hlist_node)or(type(tail)=vlist_node) or(type(tail)=dir_node) then - @; + begin f:=true; + @; end; if d<>null then if (not is_char_node(tail))and(type(tail)=disp_node) then begin prev_node:=pnode; prev_disp:=pdisp; - if prev_disp=disp_dimen(d) then free_node(tail,small_node_size) + if prev_disp=disp_dimen(d) then {|free_node(tail,small_node_size)|} else disp_dimen(tail):=disp_dimen(d); - free_node(d,small_node_size); + if f then free_node(d,small_node_size) + else begin prev_node:=tail; tail_append(d); end; end else tail_append(d); end; @@ -4964,7 +4976,10 @@ repeat p:=q; if not is_char_node(q) then if type(q)=disc_node then - begin for m:=1 to replace_count(q) do p:=link(p); + begin for m:=1 to replace_count(q) do begin + if is_char_node(p) then + if font_dir[font(p)]<>dir_default then p:=link(p); + p:=link(p); end; if p=tail then goto done; end else if type(q)=disp_node then @@ -5182,6 +5197,7 @@ @!d:pointer; {last |disp_node|} @!disp,@!pdisp:scaled; {displacement} @!pp,pnode:pointer; +@!f:boolean; {whether remove disp node d } @z @x [47.1105] l.21937 - pTeX: delete_last: disp_node @@ -5201,7 +5217,7 @@ @y else begin if (not is_char_node(tail))and(type(tail)=disp_node) then - begin d:=tail; tail:=prev_node; link(tail):=null; + begin f:=true; d:=tail; tail:=prev_node; link(tail):=null; end else d:=null; if not is_char_node(tail) then if type(tail)=cur_chr then @@ -5209,11 +5225,15 @@ repeat p:=q; if not is_char_node(q) then if type(q)=disc_node then - begin for m:=1 to replace_count(q) do p:=link(p); + begin for m:=1 to replace_count(q) do begin + if is_char_node(p) then + if font_dir[font(p)]<>dir_default then p:=link(p); + p:=link(p); end; if p=tail then begin if d<>null then tail_append(d); return; end + else if link(p)=tail then f:=false; end else if type(q)=disp_node then begin pnode:=pp; pdisp:=disp; disp:=disp_dimen(q); @@ -5226,9 +5246,10 @@ if d<>null then if (not is_char_node(tail))and(type(tail)=disp_node) then begin if prev_disp=disp_dimen(d) then - free_node(tail,small_node_size) + {|free_node(tail,small_node_size)|} else disp_dimen(tail):=disp_dimen(d); - free_node(d,small_node_size) + if f then free_node(d,small_node_size) + else begin prev_node:=tail; prev_disp:=disp; tail_append(d) end end else begin prev_node:=tail; prev_disp:=disp; tail_append(d) @@ -5357,6 +5378,15 @@ end; @z +@x [47.1121] pTeX: discretionary with 2byte-char +if n>0 then tail:=q; +@y +if n>0 then begin tail:=q; + if is_char_node(q) then + if font_dir[font(q)]<>dir_default then tail:=link(tail); + end; +@z + @x [47.1120] l.22119 - pTeX: discretionary with disp_node decr(save_ptr); return; @y @@ -5381,6 +5411,15 @@ begin print_err("Improper discretionary list"); @z + +@x [47.1121] pTeX: discretionary with 2byte-char + q:=p; p:=link(q); incr(n); +@y + q:=p; p:=link(q); incr(n); + if is_char_node(q) then + if font_dir[font(q)]<>dir_default then p:=link(p); +@z + @x [47.1123] l.22160 - pTeX: make_accent, Kanji, insert disp_node var s,@!t: real; {amount of slant} @y @@ -5397,8 +5436,10 @@ begin KANJI(cx):=cur_val; if direction=dir_tate then f:=cur_tfont else f:=cur_jfont; p:=new_character(f,get_jfm_pos(KANJI(cx),f)); - {DEBUG if p<>null then ...} - link(p):=get_avail; info(link(p)):=KANJI(cx); + if p<>null then + begin + link(p):=get_avail; info(link(p)):=KANJI(cx); + end; end else begin f:=cur_font; p:=new_character(f,cur_val); end; @@ -5593,7 +5634,7 @@ p:=nucleus(info(p)); q:=kcode_noad_nucleus(p); end; math_type(p):=math_jchar; fam(p):=cur_jfam; character(p):=qi(0); - info(q):=KANJI(cx); + math_kcode(p-1):=KANJI(cx); if font_dir[fam_fnt(fam(p)+cur_size)]=dir_default then begin print_err("Not two-byte family"); help1("IGNORE.");@/ @@ -5713,7 +5754,8 @@ space_factor:=1000; unsave; end @y -begin if direction=dir_tate then disp:=axis_height(text_size) else disp:=0; +begin if direction=dir_tate then disp:=t_baseline_shift + else disp:=y_baseline_shift; @; tail_append(new_math(math_surround,before)); cur_mlist:=p; cur_style:=text_style; mlist_penalties:=(mode>0); mlist_to_hlist; @@ -7196,6 +7238,15 @@ mark_node,adjust_node,ins_node,whatsit_node: {These nodes are vanished when typeset is done} do_nothing; + disc_node: begin insert_skip:=no_skip; i:=replace_count(p); + for i:=i downto 1 do begin + if is_char_node(p) then + if font_dir[font(p)]<>dir_default then begin + insert_skip:=after_wchar; p:=link(p); end + else insert_skip:=after_schar + else insert_skip:=no_skip; + p:=link(p); end; + end; othercases insert_skip:=no_skip; endcases; q:=p; p:=link(p); @@ -7386,6 +7437,12 @@ penalty_node,mark_node,adjust_node,whatsit_node, glue_node,kern_node,math_node,disp_node: do_nothing; + disc_node: begin i:=replace_count(p); + for i:=i downto 1 do begin + if is_char_node(p) then + if font_dir[font(p)]<>dir_default then p:=link(p); + p:=link(p); end; + q:=p; s:=null; end; othercases begin q:=p; s:=null; end; endcases; end; @@ -7544,7 +7601,7 @@ {@;} ins_kp:=false; goto main_loop; end else begin { Kanji -> cs } - {@;} + { ;} goto reswitch; end; --- ./tetex-src-3.0/texk/xdvik/gui/xm_prefs_page.c.org 2010-09-01 01:08:27.000000000 +0900 +++ ./tetex-src-3.0/texk/xdvik/gui/xm_prefs_page.c 2010-09-01 01:20:13.000000000 +0900 @@ -95,9 +95,14 @@ { "A3", "a3", "297x420mm", "420x297mm" }, { "A4", "a4", "210x297mm", "297x210mm" }, { "A5", "a5", "148x210mm", "210x148mm" }, + { "B4", "b4", "250x353mm", "353x250mm" }, { "B5", "b5", "176x250mm", "250x176mm" }, { "B6", "b6", "125x176mm", "176x125mm" }, { "B7", "b7", "88x125mm", "125x88mm" }, + { "JIS B4", "jisb4", "257x364mm", "364x257mm" }, + { "JIS B5", "jisb5", "182x257mm", "257x182mm" }, + { "JIS B6", "jisb6", "128x182mm", "182x128mm" }, + { "JIS B7", "jisb7", "91x128mm", "128x91mm" }, { NULL, NULL, NULL, NULL } /* terminate */ }; --- ./tetex-src-3.0/texk/xdvik/xdvi.c.org 2010-09-01 01:08:27.000000000 +0900 +++ ./tetex-src-3.0/texk/xdvik/xdvi.c 2010-09-01 01:20:13.000000000 +0900 @@ -1002,6 +1002,34 @@ "b10r","44x31mm", "", "0", + /* JIS `B' formats, Portrait */ + "jisb0", "1030x1456mm", + "jisb1", "728x1030mm", + "jisb2", "515x728mm", + "jisb3", "364x515mm", + "jisb4", "257x364mm", + "jisb5", "182x257mm", + "jisb6", "128x182mm", + "jisb7", "91x128mm", + "jisb8", "64x91mm", + "jisb9", "45x64mm", + "jisb10","32x45mm", + "", "0", + + /* JIS `B' formats, Landscape */ + "jisb0r", "1456x1030mm", + "jisb1r", "1030x728mm", + "jisb2r", "728x515mm", + "jisb3r", "515x364mm", + "jisb4r", "364x257mm", + "jisb5r", "257x182mm", + "jisb6r", "182x128mm", + "jisb7r", "128x91mm", + "jisb8r", "91x64mm", + "jisb9r", "64x45mm", + "jisb10r","45x32mm", + "", "0", + /* ISO `C' formats, Portrait */ "c0", "917x1297mm", "c1", "648x917mm", EOF ) (cd ptetex3-20090610/macro && cp -p ../../jsclasses-100314.zip . ) (cd ptetex3-20090610 && cp -p my_option.sample my_option && patch -p0 -b -z.org < ../ptetex3-20090610-ubagami.patch )