kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=96dde44a14741a8f378603a171ab41c74eb2b812

commit 96dde44a14741a8f378603a171ab41c74eb2b812
Author: Kim Woelders <k...@woelders.dk>
Date:   Fri Feb 9 17:39:15 2018 +0100

    Fix potential OOB memory access if border elements are negative
---
 src/lib/api.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lib/api.c b/src/lib/api.c
index cf2e25c..5f3c301 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -1551,10 +1551,10 @@ imlib_image_set_border(Imlib_Border * border)
        && (im->border.top == border->top)
        && (im->border.bottom == border->bottom))
       return;
-   im->border.left = border->left;
-   im->border.right = border->right;
-   im->border.top = border->top;
-   im->border.bottom = border->bottom;
+   im->border.left = MAX(0, border->left);
+   im->border.right = MAX(0, border->right);
+   im->border.top = MAX(0, border->top);
+   im->border.bottom = MAX(0, border->bottom);
    __imlib_DirtyPixmapsForImage(im);
 }
 

-- 


Reply via email to