]> git.sesse.net Git - mlt/commitdiff
fix possible segfault on borders, used >= for
authorMarco Gittler <g.marco@freenet.de>
Wed, 5 Sep 2012 17:46:48 +0000 (19:46 +0200)
committerMarco Gittler <g.marco@freenet.de>
Wed, 5 Sep 2012 17:46:48 +0000 (19:46 +0200)
better readablility

src/modules/videostab/transform_image.c

index a2e6de561243464d1cbb16de1512bbdc788bcc8b..c0a8751af6d15c462313c64043e93b6ef06dae9b 100644 (file)
@@ -82,7 +82,7 @@ void interpolateBiCub(unsigned char *rv, float x, float y,
                       unsigned char* img, int width, int height, unsigned char def,unsigned char N, unsigned char channel)
 {
     // do a simple linear interpolation at the border
-    if (x < 1 || x > width-2 || y < 1 || y > height - 2) {
+    if (x < 1 || x >= width-2 || y < 1 || y >= height - 2) {
         interpolateBiLinBorder(rv, x,y,img,width,height,def,N,channel);
     } else {
         int x_f = myfloor(x);
@@ -116,7 +116,7 @@ void interpolateBiCub(unsigned char *rv, float x, float y,
 void interpolateSqr(unsigned char *rv, float x, float y,
                     unsigned char* img, int width, int height, unsigned char def,unsigned char N, unsigned char channel)
 {
-    if (x < 0 || x > width-1 || y < 0 || y > height - 1) {
+    if (x < 0 || x >= width-1 || y < 0 || y >= height-1) {
         interpolateBiLinBorder(rv, x, y, img, width, height, def,N,channel);
     } else {
         int x_f = myfloor(x);
@@ -141,7 +141,7 @@ void interpolateBiLin(unsigned char *rv, float x, float y,
                       unsigned char* img, int width, int height,
                       unsigned char def,unsigned char N, unsigned char channel)
 {
-    if (x < 0 || x > width-1 || y < 0 || y > height - 1) {
+    if (x < 0 || x >= width-1 || y < 0 || y >= height - 1) {
         interpolateBiLinBorder(rv, x, y, img, width, height, def,N,channel);
     } else {
         int x_f = myfloor(x);