<div dir="ltr">Hello,<br><br>I am trying to produce a PDF/A-2U compliant pdf file using pdflatex version:<br>pdfTeX 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian).<div>The problem seems to be related to the produced unicode CMap in the resulting pdf file, which seems to not always adhere strictly to the pdf specifications, specifically regarding the beginbfrange operator. Supposedly:<br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><i>When defining ranges of this type, the value of the last byte in the string shall be less than or equal to 255 − (srcCode2 − srcCode1). This ensures that the last byte of the string shall not be incremented past 255; otherwise, the result of mapping is undefined.</i></div></blockquote><div>(<a href="https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf" target="_blank">https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf</a>, page 295; thanks to @bdoubrov for pointing this out)</div><div><br>In (do_)write_tounicode in<br>- <a href="https://github.com/TeX-Live/texlive-source/blob/4f771e41a6c3799e9d16e44633c7fa95dc41f1bc/texk/web2c/pdftexdir/tounicode.c#L382" target="_blank">https://github.com/TeX-Live/texlive-source/blob/4f771e41a6c3799e9d16e44633c7fa95dc41f1bc/texk/web2c/pdftexdir/tounicode.c#L382</a> (as well as<br>- <a href="https://github.com/TeX-Live/texlive-source/blob/4f771e41a6c3799e9d16e44633c7fa95dc41f1bc/texk/web2c/luatexdir/font/tounicode.c#L394" target="_blank">https://github.com/TeX-Live/texlive-source/blob/4f771e41a6c3799e9d16e44633c7fa95dc41f1bc/texk/web2c/luatexdir/font/tounicode.c#L394</a>),<br>it seems that ranges are identified spanning adjacent unicode codes, but I don't see any check for an overflow (reaching values above 255) in the last unicode byte.<br>Is it possible that the issue comes from this merging of adjacent codes without the check for the additional format requirement?<br><br>I have originally reported issue for veraPDF, please see my posting there<br>for a minimal (non)-working example and the resulting pdf file, as well as the produced unicode cmap which was retrieved from the pdf by @bdoubrov:<br><a href="https://github.com/veraPDF/veraPDF-library/issues/1253#issuecomment-1420125850" target="_blank">https://github.com/veraPDF/veraPDF-library/issues/1253#issuecomment-1420125850</a><br><br>Thanks and best,<br>Ben<br><br></div></div>