From 9e8b8a119d449b721845d81ffe9b3eb40c9bbebf Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 9 Nov 2009 20:15:50 -0800 Subject: [PATCH] enable mdp debugging on error, also check for invalid inputs --- libcopybit/copybit.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp index 367941b..ba8531b 100644 --- a/libcopybit/copybit.cpp +++ b/libcopybit/copybit.cpp @@ -36,7 +36,7 @@ #include "gralloc_priv.h" -#define DEBUG_MDP_ERRORS 0 +#define DEBUG_MDP_ERRORS 1 /******************************************************************************/ @@ -359,7 +359,13 @@ static int stretch_copybit( return -EINVAL; } } - + + if (src_rect->l < 0 || src_rect->r > src->w || + src_rect->t < 0 || src_rect->b > src->h) { + // this is always invalid + return -EINVAL; + } + const uint32_t maxCount = sizeof(list.req)/sizeof(list.req[0]); const struct copybit_rect_t bounds = { 0, 0, dst->w, dst->h }; struct copybit_rect_t clip;