<div dir="ltr">Hi,<div><br></div><div>There seems to be a possible SEGV (null pointer dereference) in <font face="monospace">texk/web2c/pdftexdir/writet1.c</font>.  The relevant code snippet is:<br><br><font face="monospace">    /*<br>       check for `dup <index> <glyph> put'<br>     */<br>    if (sscanf(p, "dup %i%255s put", &i, t1_buf_array) == 2 &&<br>        *t1_buf_array == '/' && valid_code(i)) {<br>        if (strcmp(t1_buf_array + 1, notdef) != 0)<br>            glyph_names[i] = xstrdup(t1_buf_array + 1);<br>        p = strstr(p, " put") + strlen(" put");<br>        skip(p, ' ');<br>    }</font><br><br>The code seems to assume that if <font face="monospace">sscanf()</font> returns 2 then the format string was fully matched including the "put" substring.  The problem is that <font face="monospace">sscanf()</font> will also return 2 even if the "put" substring is missing provided both the i and t1_buf_array are matched and assigned (see <font face="monospace">scanf</font> manpage).  This causes <font face="monospace">strstr()</font> to return <font face="monospace">NULL</font>, leading to a null pointer dereference in the next line.<br><br>Sample stack trace:<br><br><font face="monospace">Program received signal SIGSEGV, Segmentation fault.<br>t1_builtin_enc () at ../../../texk/web2c/pdftexdir/writet1.c:845<br>...<br>#0  t1_builtin_enc () at ../../../texk/web2c/pdftexdir/writet1.c:845<br>#1  t1_subset_ascii_part () at ../../../texk/web2c/pdftexdir/writet1.c:1320<br>#2  0x000055555562dc5a in writet1 (fd=0x555555838960) at ../../../texk/web2c/pdftexdir/writet1.c:1697<br>#3  write_fontfile (fd=0x555555838960) at ../../../texk/web2c/pdftexdir/writefont.c:406<br>#4  0x000055555563126e in write_fontdescriptor (fd=0x555555838960) at ../../../texk/web2c/pdftexdir/writefont.c:462<br>#5  0x000055555563177d in write_fontdescriptors () at ../../../texk/web2c/pdftexdir/writefont.c:534<br>#6  0x000055555562a627 in writefontstuff () at ../../../texk/web2c/pdftexdir/writefont.c:613<br>#7  closefilesandterminate () at /usr/src/texlive-bin-2022.20220321.62855-5ubuntu0.1/Work/texk/web2c/pdftex0.c:40300<br>#8  0x00005555555af7e5 in mainbody () at /usr/src/texlive-bin-2022.20220321.62855-5ubuntu0.1/Work/texk/web2c/pdftexini.c:5660<br>#9  main (ac=<optimized out>, av=<optimized out>) at ../../../texk/web2c/lib/texmfmp.c:1175</font><br><br>Attached is a (corrupted) PoC <font face="monospace">cmr10.pfb</font> file that can be used to reproduce the problem.  Replacing the system version and using pdflatex or pdftex works for me.<br></div><div><br></div><div>-Greg.</div></div>