libxpm/cxpm hangs in an infinite loop when loading a crafted xpm file
By providing a specially crafted xpm
file, cxpm
stuck in an infinite loop.
Steps to reproduce
- Checkout latest master of libxpm from (https://cgit.freedesktop.org/xorg/lib/libXpm)
- Compile on Ubuntu with default options
$ cd libxpm/cxpm
-
$ ./cxpm test.xpm
(This results in an infinite loop)
Attached is test.xpm
and a patch
that fixes the issue.
After the patch is applied, an error message is shown
$ ./cxpm test.xpm
Xpm Error: Invalid XPM file.
Error found line 5 near character 18
$
Best regards and many thanks
Martin Ettl fix_hang.patchtest.xpm