<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% -*- mode: tex -*-
%-
% See unicodedomino.sty for copyright and licence terms. Furthermore
% this file is dual-licenced under the LPPL version 1.3c or later.
%-
% Fix check for illegal sequences to fail overlong encoded sequences
% as well as codepoints outside of the Unicode range [0;10FFFF]. Add
% "F4 to the list of permitted lead octets.

%: https://github.com/latex3/latex2e/pull/83
% new check for illegal sequences
\gdef\UTFviii@checkseq#1:#2#3\empty{%
 \ifnum`#2&lt;"80 %
  \ifx\empty#3\empty%
  \else%
   1%
  \fi%
 \else%
  \ifnum`#2&lt;"C2 %
   1%
  \else%
   \ifnum`#2&lt;"E0 %
    % one 80-BF
    \UTFviii@check@one#3\empty%
   \else%
    \ifnum`#2&lt;"E1 %
     % A0-BF + one 80-BF
     \UTFviii@check@two"A0.#3\empty%
    \else%
     \ifnum`#2&lt;"F0 %
      % two 80-BF
      \UTFviii@check@two"80.#3\empty%
     \else%
      \ifnum`#2&lt;"F1 %
       % 90-BF + two 80-BF
       \UTFviii@check@three"90."BF.#3\empty%
      \else%
       \ifnum`#2&lt;"F4 %
        % three 80-BF
        \UTFviii@check@three"80."BF.#3\empty%
       \else%
        \ifnum`#2&lt;"F5 %
         % 80-8F + two 80-BF
         \UTFviii@check@three"80."8F.#3\empty%
        \else%
         1%
        \fi%
       \fi%
      \fi%
     \fi%
    \fi%
   \fi%
  \fi%
 \fi%
}%
\gdef\UTFviii@check@one#1#2\empty{%
 \ifx\empty#2\empty%
  \ifnum`#1&lt;"80 %
   1%
  \else%
   \ifnum`#1&gt;"BF %
    1%
   \fi%
  \fi%
 \else%
  1%
 \fi%
}%
\gdef\UTFviii@check@two#1.#2#3\empty{%
 \ifx\empty#3\empty%
  1%
 \else%
  \ifnum`#2&lt;#1 %
   1%
  \else%
   \ifnum`#2&gt;"BF %
    1%
   \else%
    \UTFviii@check@one#3\empty%
   \fi%
  \fi%
 \fi%
}%
\gdef\UTFviii@check@three#1.#2.#3#4\empty{%
 \ifx\empty#4\empty%
  1%
 \else%
  \ifnum`#3&lt;#1 %
   1%
  \else%
   \ifnum`#3&gt;#2 %
    1%
   \else%
    \UTFviii@check@two"80.#4\empty%
   \fi%
  \fi%
 \fi%
}%

%: fixed upstream
% bugfix: disallow too large definitions
\let\unicodedomino@parse@XML@charref\parse@XML@charref%
\gdef\parse@XML@charref{%
 \ifnum\count@&gt;"10FFFF\relax%
  \PackageError{inputenc}{%
   Cannot define Unicode char value\space%
   \UTFviii@hexnumber\count@\space%
   (too large)%
  }%
 \fi%
 \unicodedomino@parse@XML@charref%
}%

%: also merged
% bugfix: add "F4 to the list of permitted lead octets
% (needs the above fix)
\begingroup%
\catcode`\~13
\uccode`\~"F4
\def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@four@octets\string~}}%
\uppercase\expandafter{\UTFviii@tmp}%
\endgroup%
</pre></body></html>