We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17b6c7e commit cd4663dCopy full SHA for cd4663d
libavcodec/smacker.c
@@ -43,7 +43,7 @@
43
44
#define SMKTREE_BITS 9
45
#define SMK_NODE 0x80000000
46
-
+#define SMKTREE_DECODE_MAX_RECURSION 32
47
48
typedef struct SmackVContext {
49
AVCodecContext *avctx;
@@ -97,6 +97,11 @@ enum SmkBlockTypes {
97
static int smacker_decode_tree(BitstreamContext *bc, HuffContext *hc,
98
uint32_t prefix, int length)
99
{
100
+ if (length > SMKTREE_DECODE_MAX_RECURSION) {
101
+ av_log(NULL, AV_LOG_ERROR, "Maximum tree recursion level exceeded.\n");
102
+ return AVERROR_INVALIDDATA;
103
+ }
104
+
105
if (!bitstream_read_bit(bc)) { // Leaf
106
if(hc->current >= 256){
107
av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
0 commit comments