diff --git a/programs/develop/libraries/libs-dev/libimg/pnm/pnm.asm b/programs/develop/libraries/libs-dev/libimg/pnm/pnm.asm index af4fd88d0b..a3db163b48 100644 --- a/programs/develop/libraries/libs-dev/libimg/pnm/pnm.asm +++ b/programs/develop/libraries/libs-dev/libimg/pnm/pnm.asm @@ -158,6 +158,18 @@ endl .header_parsed: + cmp [data_type], PNM_RAW + jne @f + mov ecx, [width] + imul ecx, [height] + lea eax, [ecx*3] + mov edx, [_data] + add edx, [_length] + sub edx, esi + cmp eax, edx + ja .error + @@: + mov eax, [pnm_type] cmp eax, PNM_PBM je .pbm @@ -172,6 +184,11 @@ include 'pbm.asm' include 'pgm.asm' include 'ppm.asm' + .error: + popa + xor eax, eax + ret + .quit: popa mov eax, [retvalue]