Skip to content

Commit

Permalink
Fix #3666: Properly catch out-of-bounds image reads (based on patch b…
Browse files Browse the repository at this point in the history
…y Rubidium)
  • Loading branch information
Hirundo committed Feb 11, 2012
1 parent b2f1327 commit c2db67b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nml/output_grf.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def print_sprite(self, sprite_info):
y = sprite_info.ypos.value
size_x = sprite_info.xsize.value
size_y = sprite_info.ysize.value
(im_width, im_height) = im.size
if x + size_x > im_width or y + size_y > im_height:
raise generic.ScriptError("Read beyond bounds of image file '%s'" % sprite_info.file.value, sprite_info.file.pos)
sprite = im.crop((x, y, x + size_x, y + size_y))

# Check for white pixels; those that cause "artefacts" when shading
Expand Down

0 comments on commit c2db67b

Please sign in to comment.