Skip to content

Hangs, unbounded memory consumption when \def\@setfontsize present in LaTeX input #11088

@mikolysz

Description

@mikolysz

Pandoc hangs indefinitely and consumes an unbounded amount of memory when the following LaTeX command is present in an input file:

\def\foo{\@setfontsize\foo\@ixpt{10}}

For this bug to trigger, the \foo command must be used somewhere in the document.

The minimal reproducer for this bug is as follows:

%reproducer.tex
\documentclass{article}
\def\foo{\@setfontsize\foo\@ixpt{10}}
\begin{document}
\foo
test

\end{document}

The bug can be triggered with the following invocation of Pandoc:

Pandoc reproducer.tex -o reproducer.txt

This bug occurs independently of:

  • The used font size, e.g. \ixpt, \xpt.
  • The output format (tested with Markdown, txt)
  • The command name
  • Whether the command is defined directly or in a .sty file.
  • Whether the command is used directly in the document, or included e.g. in an environment definition which is ten used.

This bug does NOT appear if:

  • the \renewcommand command is used instead of \def.
  • The \foo command is defined but never used.

I have tested Pandoc versions 3.7.0.2, 3.1.3, the issue appears in both.

In the wild, the problematic command is used as part of the AAI2026.sty file. Here's A real document using this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions