jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=8e795109ac4644e5e5e3edcf502b61c0344fa663

commit 8e795109ac4644e5e5e3edcf502b61c0344fa663
Author: Jean-Philippe Andre <[email protected]>
Date:   Mon Mar 3 17:45:15 2014 +0900

    Evas filters: fix clip to target calculation
    
    It was possible to keep negative values for dx,dy which would
    then draw pixels out of bounds (= crash).
    
    Make check crashed after the previous commit.
    
    @fix
---
 src/lib/evas/filters/evas_filter.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lib/evas/filters/evas_filter.c 
b/src/lib/evas/filters/evas_filter.c
index 2dce45c..6d2d7f8 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -1558,6 +1558,7 @@ _clip_to_target(int *sx /* OUT */, int *sy /* OUT */, int 
sw, int sh,
 {
    if (ox > 0)
      {
+        (*sx) = 0;
         (*dx) = ox;
         (*cols) = sw;
         if (((*dx) + (*cols)) > (dw))
@@ -1565,18 +1566,21 @@ _clip_to_target(int *sx /* OUT */, int *sy /* OUT */, 
int sw, int sh,
      }
    else if (ox < 0)
      {
+        (*dx) = 0;
         (*sx) = (-ox);
         (*cols) = sw - (*sx);
         if ((*cols) > dw) (*cols) = dw;
      }
    else
      {
+        (*dx) = 0;
         (*cols) = sw;
         if ((*cols) > dw) (*cols) = dw;
      }
 
    if (oy > 0)
      {
+        (*sy) = 0;
         (*dy) = oy;
         (*rows) = sh;
         if (((*dy) + (*rows)) > (dh))
@@ -1584,12 +1588,14 @@ _clip_to_target(int *sx /* OUT */, int *sy /* OUT */, 
int sw, int sh,
      }
    else if (oy < 0)
      {
+        (*dy) = 0;
         (*sy) = (-oy);
         (*rows) = sh - (*sy);
         if ((*rows) > dh) (*rows) = dh;
      }
    else
      {
+        (*dy) = 0;
         (*rows) = sh;
         if ((*rows) > dh) (*rows) = dh;
      }

-- 


Reply via email to