The ppm format specifies that the maximum color value field must be
less than 65536. The handler did not enforce this, leading to
potentional overflow when the value was used in 16 bits context.
Based on Qt5 patch for CVE-2018-19872.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 4470facd61)
Make the decoder fail early to avoid spending time and memory on
attempting to decode a corrupt image file.
Based on Qt5 patch for CVE-2018-19873.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 5a61151fe9)