From ed670f41858962cfd0fc67f4ea452c820274d4e1 Mon Sep 17 00:00:00 2001 From: Ari Koivula Date: Tue, 5 May 2015 10:58:47 +0300 Subject: [PATCH] Fix coverity warning. - False positive about buffer overrun due to thinking work_tree_copy_up could be called with depth == 4. --- src/search.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/search.c b/src/search.c index 6949a539..e0514ae1 100644 --- a/src/search.c +++ b/src/search.c @@ -1221,6 +1221,8 @@ static int search_cu_inter(const encoder_state_t * const state, int x, int y, in */ static void work_tree_copy_up(int x_px, int y_px, int depth, lcu_t work_tree[MAX_PU_DEPTH + 1]) { + assert(depth >= 0 && depth < MAX_PU_DEPTH); + // Copy non-reference CUs. { const int x_cu = SUB_SCU(x_px) >> MAX_DEPTH; @@ -1274,6 +1276,8 @@ static void work_tree_copy_up(int x_px, int y_px, int depth, lcu_t work_tree[MAX */ static void work_tree_copy_down(int x_px, int y_px, int depth, lcu_t work_tree[MAX_PU_DEPTH + 1]) { + assert(depth >= 0 && depth < MAX_PU_DEPTH); + // TODO: clean up to remove the copy pasta const int width_px = LCU_WIDTH >> depth;