From faaa8ac870814de2d120849149f308ae8daaf751 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Date: Thu, 17 Apr 2025 20:26:01 +0200 Subject: [PATCH 05/13] avcodec/vp6: Forward error codes Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/vp6.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index 69cfc5fa8b..48ff9da818 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -298,6 +298,7 @@ static int vp6_parse_coeff_models(VP56Context *s) int node, cg, ctx, pos; int ct; /* code type */ int pt; /* plane type (0 for Y, 1 for U or V) */ + int ret; memset(def_prob, 0x80, sizeof(def_prob)); @@ -335,21 +336,25 @@ static int vp6_parse_coeff_models(VP56Context *s) if (s->use_huffman) { for (pt=0; pt<2; pt++) { - if (vp6_build_huff_tree(s, model->coeff_dccv[pt], - vp6_huff_coeff_map, 12, AC_DC_HUFF_BITS, - &s->dccv_vlc[pt])) - return -1; - if (vp6_build_huff_tree(s, model->coeff_runv[pt], - vp6_huff_run_map, 9, RUN_HUFF_BITS, - &s->runv_vlc[pt])) - return -1; + ret = vp6_build_huff_tree(s, model->coeff_dccv[pt], + vp6_huff_coeff_map, 12, AC_DC_HUFF_BITS, + &s->dccv_vlc[pt]); + if (ret < 0) + return ret; + ret = vp6_build_huff_tree(s, model->coeff_runv[pt], + vp6_huff_run_map, 9, RUN_HUFF_BITS, + &s->runv_vlc[pt]); + if (ret < 0) + return ret; for (ct=0; ct<3; ct++) - for (int cg = 0; cg < 4; cg++) - if (vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg], - vp6_huff_coeff_map, 12, - AC_DC_HUFF_BITS, - &s->ract_vlc[pt][ct][cg])) - return -1; + for (int cg = 0; cg < 4; cg++) { + ret = vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg], + vp6_huff_coeff_map, 12, + AC_DC_HUFF_BITS, + &s->ract_vlc[pt][ct][cg]); + if (ret < 0) + return ret; + } } memset(s->nb_null, 0, sizeof(s->nb_null)); } else { -- 2.45.2