summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-04-27 11:11:27 +0200
committerPaul B Mahol <onemda@gmail.com>2023-04-27 21:38:21 +0200
commit595f0cbb4aeac1ead7c7f887d5a06ef6a1bb0fe2 (patch)
treeeaf0c0cf7f56dc823373430749cc9b3bb581de91
parent44c8f7df03617ce524f01e1a46b4d845527843bd (diff)
downloadffmpeg-595f0cbb4aeac1ead7c7f887d5a06ef6a1bb0fe2.tar.gz
avcodec/smacker: do not use NULL for av_log()
-rw-r--r--libavcodec/smacker.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index ecc27e9b67..a514120b65 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -107,16 +107,16 @@ enum SmkBlockTypes {
* Can read SMKTREE_DECODE_MAX_RECURSION before the first check;
* does not overread gb on success.
*/
-static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, int length)
+static int smacker_decode_tree(AVCodecContext *avctx, GetBitContext *gb, HuffContext *hc, int length)
{
if (length > SMKTREE_DECODE_MAX_RECURSION || length > 3 * SMKTREE_BITS) {
- av_log(NULL, AV_LOG_ERROR, "Maximum tree recursion level exceeded.\n");
+ av_log(avctx, AV_LOG_ERROR, "Maximum tree recursion level exceeded.\n");
return AVERROR_INVALIDDATA;
}
if(!get_bits1(gb)){ //Leaf
if (hc->current >= 256) {
- av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
+ av_log(avctx, AV_LOG_ERROR, "Tree size exceeded!\n");
return AVERROR_INVALIDDATA;
}
if (get_bits_left(gb) < 8)
@@ -126,10 +126,10 @@ static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, int length)
} else { //Node
int r;
length++;
- r = smacker_decode_tree(gb, hc, length);
+ r = smacker_decode_tree(avctx, gb, hc, length);
if(r)
return r;
- return smacker_decode_tree(gb, hc, length);
+ return smacker_decode_tree(avctx, gb, hc, length);
}
}
@@ -138,7 +138,7 @@ static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, int length)
*
* Checks before the first read, can overread by 6 * SMKTREE_BITS on success.
*/
-static int smacker_decode_bigtree(GetBitContext *gb, DBCtx *ctx, int length)
+static int smacker_decode_bigtree(AVCodecContext *avctx, GetBitContext *gb, DBCtx *ctx, int length)
{
// Larger length can cause segmentation faults due to too deep recursion.
if (length > SMKTREE_DECODE_BIG_MAX_RECURSION) {
@@ -176,12 +176,12 @@ static int smacker_decode_bigtree(GetBitContext *gb, DBCtx *ctx, int length)
int r = 0, r_new, t;
t = ctx->current++;
- r = smacker_decode_bigtree(gb, ctx, length + 1);
+ r = smacker_decode_bigtree(avctx, gb, ctx, length + 1);
if(r < 0)
return r;
ctx->values[t] = SMK_NODE | r;
r++;
- r_new = smacker_decode_bigtree(gb, ctx, length + 1);
+ r_new = smacker_decode_bigtree(avctx, gb, ctx, length + 1);
if (r_new < 0)
return r_new;
return r + r_new;
@@ -215,7 +215,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
i ? "high" : "low");
continue;
}
- err = smacker_decode_tree(gb, &h, 0);
+ err = smacker_decode_tree(smk->avctx, gb, &h, 0);
if (err < 0)
goto error;
skip_bits1(gb);
@@ -253,7 +253,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
}
*recodes = ctx.values;
- err = smacker_decode_bigtree(gb, &ctx, 0);
+ err = smacker_decode_bigtree(smk->avctx, gb, &ctx, 0);
if (err < 0)
goto error;
skip_bits1(gb);
@@ -649,7 +649,7 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame,
HuffContext h;
h.current = 0;
skip_bits1(&gb);
- if ((ret = smacker_decode_tree(&gb, &h, 0)) < 0)
+ if ((ret = smacker_decode_tree(avctx, &gb, &h, 0)) < 0)
goto error;
skip_bits1(&gb);
if (h.current > 1) {