mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
WRaster: Stop parsing number in PPM file if invalid syntax is found
When the function 'pm_getuint' is reading a number, it prints an error message if it encounters a non-digit number, yet it still enters the processing loop which will cause an invalid number to be calculated. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
8e47ca8e62
commit
d125f80dee
@@ -85,8 +85,10 @@ int pm_getuint(FILE * const ifP)
|
|||||||
ch = pm_getc(ifP);
|
ch = pm_getc(ifP);
|
||||||
} while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
|
} while (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r');
|
||||||
|
|
||||||
if (ch < '0' || ch > '9')
|
if (ch < '0' || ch > '9') {
|
||||||
fprintf(stderr, "junk in file where an unsigned integer should be\n");
|
fprintf(stderr, "junk in file where an unsigned integer should be\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
|
|||||||
Reference in New Issue
Block a user