diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c index 7fa2b49638..cf7edccb8b 100644 --- a/libavcodec/vvc/ctu.c +++ b/libavcodec/vvc/ctu.c @@ -1889,7 +1889,7 @@ static int palette_signaled(VVCLocalContext *lc, const bool local_dual_tree, const int size = nb_predicted + nb_signaled; const bool dual_tree_luma = local_dual_tree && cu->tree_type == DUAL_TREE_LUMA; - if (size > max_entries) + if (size > max_entries || nb_signaled < 0) return AVERROR_INVALIDDATA; for (int c = start; c < end; c++) {