Skip to content

Commit

Permalink
add extra meaning test for #1448
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcarlisle committed Oct 30, 2024
1 parent 55b5b79 commit 2da0282
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
27 changes: 20 additions & 7 deletions required/amsmath/amsmath.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ Bug reports can be opened (category \texttt{#1}) at\\%
% \begin{macrocode}
\DeclareRelease{}{1994-06-01}{amsmath-2018-12-01.sty}
\DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty}
\DeclareCurrentRelease{}{2019-04-01}
\DeclareCurrentRelease{}{2024-10-30}
% \end{macrocode}
%
% \begin{macrocode}
\ProvidesPackage{amsmath}[2024/08/11 v2.17r AMS math features]
\ProvidesPackage{amsmath}[2024/10/30 v2.17s AMS math features]
% \end{macrocode}
%
% \section{Catcode defenses}
Expand Down Expand Up @@ -1039,6 +1039,13 @@ Foreign command \@backslashchar#1;\MessageBreak
}
\fi
% \end{macrocode}
% \changes{v2.17s}{2024/10/30}{guard against primitive if (gh/1448)}
% \begin{macrocode}
{\uccode`7=`\\ \uccode`(=`i \uccode`)=`f
\uppercase{\gdef\testif@#1#2#3#4\testif@{%
\ifx7#1\ifx(#2\ifx)#3\@tempswafalse\fi\fi\fi}
}}
% \end{macrocode}
% \begin{macrocode}
\newcount\classnum@
\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096
Expand Down Expand Up @@ -1159,11 +1166,17 @@ Foreign command \@backslashchar#1;\MessageBreak
% \changes{v2.15d}{2016/06/28}{Add space token to prevent runaway
% argument error}
% \changes{v2.17r}{2024/06/29}{Drop \cs{protect} if present (gh/1265)}
% \begin{macrocode}
\begingroup
\def\protect{\protect}% % make it a quark
\xdef\meaning@{\@xp\stripprotect@\@let@token.........\stripprotect@. .........}%
\endgroup
% \changes{v2.17s}{2024/10/30}{skip protect testif detect primitive if (gh/1448)}
% \begin{macrocode}
\xdef\meaning@{\meaning\@let@token. .........}%
\@tempswatrue
\@xp\testif@\meaning@....\testif@
\if@tempswa
\begingroup
\def\protect{\protect}% % make it a quark
\xdef\meaning@{\@xp\stripprotect@\@let@token.........\stripprotect@. .........}%
\endgroup
\fi
% \end{macrocode}
% In previous versions \verb|\long| macros were not seen by the lookahead.
% That was bad as this file uses \verb|\(re)newcommand| for \verb|\implies| etc.
Expand Down
5 changes: 5 additions & 0 deletions required/tools/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
=======================================================================

2024-10-30 David Carlisle <[email protected]>

* amsmath.dtx: Guard the \protect tests from primitive if tokens
in the definition (gh/1448)

2024-10-27 David Carlisle <[email protected]>

* longtable.dtx Guard against increasing \pagegoal past \maxdimen (gh/1495)
Expand Down

0 comments on commit 2da0282

Please sign in to comment.