This image can crash both with libungif 4.1.0 and 4.1.0b1. It is special, because it uses different Geometry and Page Geometry, see output of identify -verbose: Image: /home/pavel/.Emacs/Work/x1.gif Format: GIF (CompuServe graphics interchange format) Geometry: 35x47 ... Page Geometry: 38x38+0+0 Emacs will crash in libungif, because it allocated to small region of memory. The same applies to next image I found in my archives: