OpenCV crashes in production

asked 2017-08-23 17:44:17 -0600

crook gravatar image

updated 2017-08-23 17:49:58 -0600

Hi,

I am running an application in production and I see my python process crash while performing opencv imdecode. Some of these images are bad images that usually crash the system but I need to make sure I gracefully handle this in my code and log the crash dump.

Can anyone provide suggestions on the best way to do this?

Also, I reduced the number of failures by only accepting JPEG and PNG images. I was seeing more failures with TIFF and JPEG2000s, but I would like to re-enable other image formats as well. I am in need for recommendations on the checks to make sure image decode doesn't take away all my memory or makes my service prone to DOS attacks.

Thanks, Anand

edit retag flag offensive close merge delete

Comments

just curious, - what is your server doing ?

berak gravatar imageberak ( 2017-08-24 00:01:59 -0600 )edit

My server just tries to decode the image bytes. Those image bytes sometime try to allocate lot of memory and crash. Since it's a production server, I need to make sure that the memory footprint of my application is not unbounded.

crook gravatar imagecrook ( 2017-08-25 13:51:14 -0600 )edit

I am now facing the issue for some JPEG2000 images. Did any found an answer?

diraviamrakesh gravatar imagediraviamrakesh ( 2019-06-12 10:30:12 -0600 )edit