WPrefs: add check for image validity in 'loadRImage' (Coverity #50221, #50081)
commit3a15750ad5f2db191c2a73d7c14516bc2efe51ba
authorChristophe CURIS <christophe.curis@free.fr>
Sat, 15 Nov 2014 18:41:00 +0000 (15 19:41 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 23 Nov 2014 22:43:38 +0000 (23 22:43 +0000)
treea66ca1fd45a06874484a8df6640a4ac1a6bbfc42
parentd1e1521a88ef7de6275603d238d45460cd3ce227
WPrefs: add check for image validity in 'loadRImage' (Coverity #50221, #50081)

As pointed by Coverity, the function blindly trust the data read from the
file, but in case of problem (corrupted file, not enough memory) it could
behave badly.

This patch adds a check for the depth, counts on RCreateImage to check the
width and height, and in any case it now includes a message for the user in
case he would like to understand what's wrong.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
WPrefs.app/Appearance.c