imgcodecs(webp): multiple fixes
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Thu, 30 Aug 2018 19:12:01 +0000 (19:12 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Thu, 30 Aug 2018 20:42:33 +0000 (20:42 +0000)
commit0515f930e87f2817dc40674913cc696558489ddf
treeb89f814ea6ace096283d476cc16b7e2bd5a1b10c
parentfc1dee685e60149b0056d69eae63a51d94c31699
imgcodecs(webp): multiple fixes

- don't reallocate passed 'img' (test fixed - must use IMREAD_UNCHANGED / IMREAD_ANYCOLOR)
- avoid memory DDOS
- avoid reading of whole file during header processing
- avoid data access after allocated buffer during header processing (missing checks)
- use WebPFree() to free allocated buffers (libwebp >= 0.5.0)
- drop unused & undefined `.close()` method
- added checks for channels >= 5 in encoder
modules/imgcodecs/src/grfmt_webp.cpp
modules/imgcodecs/src/grfmt_webp.hpp
modules/imgcodecs/src/loadsave.cpp
modules/imgcodecs/test/test_webp.cpp