From 9a76ac7beabca69daaa868a387ff1ea9dce0271e Mon Sep 17 00:00:00 2001 From: Bill Meltsner Date: Tue, 19 Oct 2010 17:15:27 -0400 Subject: [PATCH] You can no longer access out-of-range pixels in ImageData --- src/modules/image/devil/ImageData.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/image/devil/ImageData.cpp b/src/modules/image/devil/ImageData.cpp index d8ec2a3e4..dd1ad5a2d 100644 --- a/src/modules/image/devil/ImageData.cpp +++ b/src/modules/image/devil/ImageData.cpp @@ -156,6 +156,7 @@ namespace devil { //int tx = x > width-1 ? width-1 : x; //int ty = y > height-1 ? height-1 : y; // not using these seems to not break anything + if (x > width-1 || y > height-1 || x < 0 || y < 0) throw love::Exception("Attempt to set out-of-range pixel!"); pixel * pixels = (pixel *)getData(); pixels[y*width+x] = c; } @@ -164,6 +165,7 @@ namespace devil { //int tx = x > width-1 ? width-1 : x; //int ty = y > height-1 ? height-1 : y; // not using these seems to not break anything + if (x > width-1 || y > height-1 || x < 0 || y < 0) throw love::Exception("Attempt to get out-of-range pixel!"); pixel * pixels = (pixel *)getData(); return pixels[y*width+x]; }