#1144640 antiword: divide-by-zero on zero glyph width causes crash

Package:
antiword
Source:
antiword
Description:
Converts MS Word files to text, PS, PDF and XML
Submitter:
vulnreport
Date:
2026-08-24 03:45:01 UTC
Severity:
normal
Tags:
#1144640#5
Date:
2026-08-17 14:05:08 UTC
From:
To:
Dear Maintainer,

I am reporting on behalf of an engineer at Quarklsab, a divide-by-zero issue in antiword 0.37-17 which can be triggered by a specially crafted Word document.

The issue causes antiword to crash.

The problem occurs in word2text.c when the width returned for the em-dash glyph is zero. The returned value is subsequently used as the denominator of an integer division without checking for zero:

    lCharWidth = lComputeStringWidth(szOne, 1, pOutput->tFontRef,
                                     pOutput->usFontSize);
    iChars = (int)((144000 + lCharWidth / 2) / lCharWidth);

When lCharWidth is zero, this results in an integer divide-by-zero.

CWE: CWE-369 (Divide By Zero)

Reproduction
============

With the attached PoC document:

    antiword -a a4 ./sample_dos_1.doc

Observed behavior:
antiword crashes due to the divide-by-zero.

Expected behavior:
antiword should reject or safely handle the malformed document without crashing.

The issue was reproduced with antiword 0.37-17.

I have attached the PoC document and a technical report containing further details.

Regards,
Salwa
Quarkslab VulnReport Team