libimg: check raw pnm payload size (broken files)
git-svn-id: svn://kolibrios.org@4229 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
96c7d6c310
commit
0a44c9a5ca
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user