Skip to content

Commit

Permalink
Avoid overflow when parsing PSD resource blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed May 6, 2016
1 parent dcdd212 commit 15dd190
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion coders/psd.c
Expand Up @@ -643,7 +643,7 @@ static void ParseImageResourceBlocks(Image *image,
p=PushShortPixel(MSBEndian,p,&id); p=PushShortPixel(MSBEndian,p,&id);
p=PushShortPixel(MSBEndian,p,&short_sans); p=PushShortPixel(MSBEndian,p,&short_sans);
p=PushLongPixel(MSBEndian,p,&count); p=PushLongPixel(MSBEndian,p,&count);
if (p+count > blocks+length) if ((p+count) > (blocks+length-16))
return; return;
switch (id) switch (id)
{ {
Expand Down

0 comments on commit 15dd190

Please sign in to comment.