globocom/thumbor — pull request #214 by admingeekz (2013-10-15 00:32:48+00:00)
Title: Check first few bytes for gif files

Thumbor segfaults when the image type is gif but the extension is not. So including an extra check for the image header to see if it's a GIF.

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeb4c61cb in FROM_IplImagePTR(_IplImage*) () from /usr/lib64/python2.6/site-packages/cv2.so
(gdb) bt
#0 0x00007fffeb4c61cb in FROM_IplImagePTR(_IplImage*) () from /usr/lib64/python2.6/site-packages/cv2.so
#1 0x00007fffeb4c640c in pycvDecodeImage(_object*, _object*, _object*) () from /usr/lib64/python2.6/site-packages/cv2.so
#2 0x00007ffff7b0c9e4 in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0
#3 0x00007ffff7b0db8f in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0
#4 0x00007ffff7b0db8f in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0
#5 0x00007ffff7b0e657 in PyEval_EvalCodeEx () from /usr/lib64/libpython2.6.so.1.0
#6 0x00007ffff7b0caa4 in PyEval_EvalFrameEx () from /usr/lib64/libpython2.6.so.1.0