pdftex[910] branches/stable: guard against corrupt pfb in dup tests

commits+karl at tug.org commits+karl at tug.org
Sat Aug 26 19:47:24 CEST 2023


Revision: 910
          http://tug.org/svn/pdftex?view=revision&revision=910
Author:   karl
Date:     2023-08-26 19:47:24 +0200 (Sat, 26 Aug 2023)
Log Message:
-----------
guard against corrupt pfb in dup tests

Modified Paths:
--------------
    branches/stable/source/Makefile
    branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
    branches/stable/source/src/texk/web2c/pdftexdir/writet1.c
    branches/stable/tests/27-late-shipout/test-shipout.tex

Added Paths:
-----------
    branches/stable/tests/30-compositecharset/
    branches/stable/tests/30-compositecharset/Makefile
    branches/stable/tests/30-compositecharset/compositechars.tex
    branches/stable/tests/32-type1-segfault/
    branches/stable/tests/32-type1-segfault/Makefile
    branches/stable/tests/32-type1-segfault/cmr10-corrupt.pfb
    branches/stable/tests/32-type1-segfault/cmr10.tfm
    branches/stable/tests/32-type1-segfault/type1-segfault.tex

Modified: branches/stable/source/Makefile
===================================================================
--- branches/stable/source/Makefile	2023-04-30 22:33:18 UTC (rev 909)
+++ branches/stable/source/Makefile	2023-08-26 17:47:24 UTC (rev 910)
@@ -51,3 +51,16 @@
 	@echo
 	sed -n 's/^!//p'    /tmp/sat >/tmp/srm # remove these
 	ls -l /tmp/srm
+
+# 
+# tlrev=66599 # svnversion Build/source
+# yy=`date +%Y`
+# echo scom -m"sync from tl $tlrev, tl$YY release"
+# !*
+# 
+# prev=906   # from above
+# pver=`pdftex --version | sed 1q | awk '{print $2}' | sed 's/.*-//'`
+echo svn copy -r $prev \
+ -m"pdftex $pver tag based on r$prev, tl$yy r$tlrev" \
+ svn://tug.org/pdftex/branches/stable \
+ svn://tug.org/pdftex/tags/pdftex-$pver

Modified: branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2023-04-30 22:33:18 UTC (rev 909)
+++ branches/stable/source/src/texk/web2c/pdftexdir/ChangeLog	2023-08-26 17:47:24 UTC (rev 910)
@@ -1,3 +1,9 @@
+2023-08-26  Karl Berry  <karl at freefriends.org>
+
+	* writet1.c (t1_builtin_enc): guard somewhat against corrupt pfbs,
+	in the dup and dup dup checking. Report from Gregory DUCK,
+	https://tug.org/pipermail/tex-live/2023-August/049400.html.
+
 2023-03-09  Karl Berry  <karl at tug.org>
 
 	* TL'23 release.

Modified: branches/stable/source/src/texk/web2c/pdftexdir/writet1.c
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/writet1.c	2023-04-30 22:33:18 UTC (rev 909)
+++ branches/stable/source/src/texk/web2c/pdftexdir/writet1.c	2023-08-26 17:47:24 UTC (rev 910)
@@ -841,7 +841,10 @@
                 *t1_buf_array == '/' && valid_code(i)) {
                 if (strcmp(t1_buf_array + 1, notdef) != 0)
                     glyph_names[i] = xstrdup(t1_buf_array + 1);
-                p = strstr(p, " put") + strlen(" put");
+                p = strstr(p, " put");
+                if (!p)
+                    pdftex_fail("invalid pfb, no put found in dup");
+                p += strlen(" put");
                 skip(p, ' ');
             }
             /*
@@ -850,7 +853,10 @@
             else if (sscanf(p, "dup dup %i exch %i get put", &b, &a) == 2
                      && valid_code(a) && valid_code(b)) {
                 copy_glyph_names(glyph_names, a, b);
-                p = strstr(p, " get put") + strlen(" get put");
+                p = strstr(p, " get put");
+                if (!p)
+                    pdftex_fail("invalid pfb, no get put found in dup dup");
+                p += strlen(" get put");
                 skip(p, ' ');
             }
             /*
@@ -861,7 +867,10 @@
                      && valid_code(a) && valid_code(b) && valid_code(c)) {
                 for (i = 0; i < c; i++)
                     copy_glyph_names(glyph_names, a + i, b + i);
-                p = strstr(p, " putinterval") + strlen(" putinterval");
+                p = strstr(p, " putinterval");
+                if (!p)
+                   pdftex_fail("invalid pfb, no putinterval found in dup dup");
+                p += strlen(" putinterval");
                 skip(p, ' ');
             }
             /*

Modified: branches/stable/tests/27-late-shipout/test-shipout.tex
===================================================================
--- branches/stable/tests/27-late-shipout/test-shipout.tex	2023-04-30 22:33:18 UTC (rev 909)
+++ branches/stable/tests/27-late-shipout/test-shipout.tex	2023-08-26 17:47:24 UTC (rev 910)
@@ -6,7 +6,7 @@
 \output={\global\advance\count0 by 1 \shipout\box255 }
 
 \pdfoutput=1
-\pdfcompresslevel-0
+\pdfcompresslevel=0
 \pdfobjcompresslevel=0
 \hsize=4.6cm
   \pdfpagewidth=\hsize

Added: branches/stable/tests/30-compositecharset/Makefile
===================================================================
--- branches/stable/tests/30-compositecharset/Makefile	                        (rev 0)
+++ branches/stable/tests/30-compositecharset/Makefile	2023-08-26 17:47:24 UTC (rev 910)
@@ -0,0 +1,20 @@
+# $Id$
+# Public domain. /CharSet not including composite base, for some fonts.
+
+texfot = texfot
+
+pln:
+	$(texfot) pdftex compositechars.tex
+	grep -a /CharSet compositechars.pdf
+
+plt:
+	$(texfot) pdflatex compositechars.tex
+	grep -a /CharSet compositechars.pdf
+
+llt:
+	$(texfot) lualatex compositechars.tex
+	grep -a /CharSet compositechars.pdf
+
+ltx:
+	$(texfot) latex compositechars.tex
+	dvitype compositechars.dvi >typ


Property changes on: branches/stable/tests/30-compositecharset/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: branches/stable/tests/30-compositecharset/compositechars.tex
===================================================================
--- branches/stable/tests/30-compositecharset/compositechars.tex	                        (rev 0)
+++ branches/stable/tests/30-compositecharset/compositechars.tex	2023-08-26 17:47:24 UTC (rev 910)
@@ -0,0 +1,56 @@
+% $Id$
+% Public domain.
+
+\pdfoutput=1
+\pdfcompresslevel=0 \pdfobjcompresslevel=0
+\catcode`\{=1 \catcode`\}=2
+\hsize=6in \vsize=6in
+
+\pdfmapline{DejaVuSerif-tlf-t1--base DejaVuSerif     %
+ " AutoEnc_6paffcekw62ffq4g6cgalfhbtd ReEncodeFont " % 
+ <[dejavuserif_t1-type1.enc <DejaVuSerif.pfb}
+
+\output={\shipout\box255}
+%\font\x = DejaVuSerif-tlf-t1
+\font\x = DejaVuSerif-tlf-t1--base
+\x \char"E9 \end
+
+% https://tug.org/TUGboat/tb30-1/tb94thanh.pdf
+% ttf2afm -e texnansi.enc -o gentium-8y.afm GentiumPlus-Regular.ttf
+% afm2tfm gentium-8y.afm -T texnansi.enc
+% ->
+% !pdfTeX error: pdftex (file /u/texlive/karl/Master/texmf-dist/fonts/truetype/pu
+% blic/gentium-tug/GentiumPlus-Regular.ttf): unknown version of OS/2 table (0004)
+
+%% type 1 loads ok.
+%\documentclass{article}
+%\usepackage{gentium}
+%\begin{document}
+%\huge\bfseries Hello, World!
+%\end{document}
+
+%\pdfcompresslevel=0 \pdfobjecompresslevel=0
+\DocumentMetadata
+{
+            uncompress,
+            pdfstandard = a-3u,
+}
+\documentclass[letterpaper]{book}
+
+\usepackage[T1]{fontenc} 
+\usepackage{dejavu}
+% pdf/a validates if fontenc is NOT loaded. (dejavu.sty does NOT load
+% fontenc internally)
+
+%\usepackage{lipsum}
+
+% This solves the problem that occurs when fontenc is loaded.
+%\pdfomitcharset = 1
+
+\begin{document}
+%\lipsum[1]
+
+\'{e} %\`{e}
+
+%? ?
+\end{document}


Property changes on: branches/stable/tests/30-compositecharset/compositechars.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: branches/stable/tests/32-type1-segfault/Makefile
===================================================================
--- branches/stable/tests/32-type1-segfault/Makefile	                        (rev 0)
+++ branches/stable/tests/32-type1-segfault/Makefile	2023-08-26 17:47:24 UTC (rev 910)
@@ -0,0 +1,11 @@
+# $Id$
+# Public domain.
+
+include ../Common.mak
+
+test-shipout:
+	$(prog) -etex ./type1-segfault.tex
+
+clean:
+	$(clean)
+


Property changes on: branches/stable/tests/32-type1-segfault/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: branches/stable/tests/32-type1-segfault/cmr10-corrupt.pfb
===================================================================
(Binary files differ)

Index: branches/stable/tests/32-type1-segfault/cmr10-corrupt.pfb
===================================================================
--- branches/stable/tests/32-type1-segfault/cmr10-corrupt.pfb	2023-04-30 22:33:18 UTC (rev 909)
+++ branches/stable/tests/32-type1-segfault/cmr10-corrupt.pfb	2023-08-26 17:47:24 UTC (rev 910)

Property changes on: branches/stable/tests/32-type1-segfault/cmr10-corrupt.pfb
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: branches/stable/tests/32-type1-segfault/cmr10.tfm
===================================================================
(Binary files differ)

Index: branches/stable/tests/32-type1-segfault/cmr10.tfm
===================================================================
--- branches/stable/tests/32-type1-segfault/cmr10.tfm	2023-04-30 22:33:18 UTC (rev 909)
+++ branches/stable/tests/32-type1-segfault/cmr10.tfm	2023-08-26 17:47:24 UTC (rev 910)

Property changes on: branches/stable/tests/32-type1-segfault/cmr10.tfm
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/x-tex-tfm
\ No newline at end of property
Added: branches/stable/tests/32-type1-segfault/type1-segfault.tex
===================================================================
--- branches/stable/tests/32-type1-segfault/type1-segfault.tex	                        (rev 0)
+++ branches/stable/tests/32-type1-segfault/type1-segfault.tex	2023-08-26 17:47:24 UTC (rev 910)
@@ -0,0 +1,16 @@
+% $Id$
+% Public domain.
+% Test parsing of invalid Type 1. Original report:
+%   Date: Fri, 25 Aug 2023 14:54:10 +0800
+%   From: Gregory James DUCK
+%   To:  <tex-live at tug.org>
+% https://tug.org/pipermail/tex-live/2023-August/049400.html
+
+\catcode`\{=1 \catcode`\}=2
+\output={\global\advance\count0 by 1 \shipout\box255 }
+\pdfoutput=1 \hsize=4in \parfillskip=0pt plus1fil
+
+\pdfmapline{=cmr10 CMR10 <cmr10-corrupt.pfb}
+
+\font\x = ./cmr10 \x x
+\end


Property changes on: branches/stable/tests/32-type1-segfault/type1-segfault.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property


More information about the pdftex-commits mailing list.