summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Keil <fk@fabiankeil.de>2014-12-02 15:08:04 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-12-06 13:45:46 +0900
commitc21beaf1780cf3ca291735ae7d58a3dde63277a2 (patch)
tree6ae8f8a22974646b4fc7d01780384c23976876e4
parent540df42aab3b6aa1a5b774a02769758cf5b9b404 (diff)
Prevent division-by-zero crashes
-rw-r--r--src/modules/loaders/loader_pnm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/loaders/loader_pnm.c b/src/modules/loaders/loader_pnm.c
index 173e127..daf67df 100644
--- a/src/modules/loaders/loader_pnm.c
+++ b/src/modules/loaders/loader_pnm.c
@@ -229,7 +229,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
229 } 229 }
230 } 230 }
231 iptr = idata; 231 iptr = idata;
232 if (v == 255) 232 if (v == 0 || v == 255)
233 { 233 {
234 for (x = 0; x < w; x++) 234 for (x = 0; x < w; x++)
235 { 235 {
@@ -303,7 +303,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
303 } 303 }
304 } 304 }
305 iptr = idata; 305 iptr = idata;
306 if (v == 255) 306 if (v == 0 || v == 255)
307 { 307 {
308 for (x = 0; x < w; x++) 308 for (x = 0; x < w; x++)
309 { 309 {
@@ -376,7 +376,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
376 break; 376 break;
377 377
378 ptr = data; 378 ptr = data;
379 if (v == 255) 379 if (v == 0 || v == 255)
380 { 380 {
381 for (x = 0; x < w; x++) 381 for (x = 0; x < w; x++)
382 { 382 {
@@ -418,7 +418,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
418 break; 418 break;
419 419
420 ptr = data; 420 ptr = data;
421 if (v == 255) 421 if (v == 0 || v == 255)
422 { 422 {
423 for (x = 0; x < w; x++) 423 for (x = 0; x < w; x++)
424 { 424 {
@@ -493,7 +493,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
493 break; 493 break;
494 494
495 ptr = data; 495 ptr = data;
496 if (v == 255) 496 if (v == 0 || v == 255)
497 { 497 {
498 for (x = 0; x < w; x++) 498 for (x = 0; x < w; x++)
499 { 499 {