图片解压缩炸弹问题(image decompression bomb)

https://huzheyang.cn/2018/02/python图形库处理大型图片的有关问题/

像素点特别多,但是实际占用空间并不大。Image library在load图片的时候可能会根据像素点分配内存,如果再不设置任何阈值的话,那么就会造成应用程序OOM.

```

In [20]: im = Image.open('decompression_bomb.png')

/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PIL/Image.py:2496: DecompressionBombWarning: Image size (156250000 pixels) exceeds limit of 89478485 pixels, could be decompression bomb DOS attack. DecompressionBombWarning)

```

image-decompression-bomb0.png

image-decompression-bomb1.jpg