summaryrefslogtreecommitdiff
path: root/libavformat/img2dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-21 23:00:36 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-21 23:32:57 +0100
commit41ee459e88093a0b7ae13b8539ed9ccd0ebd0f0b (patch)
tree1aea9eb253b422ad40b525e5271a4911cb753927 /libavformat/img2dec.c
parentb7e506b3b9caf1d7b8b494f83a85c1b61be46993 (diff)
avformat/img2dec: check w/h in dpx_probe
Fixes probetest failure Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/img2dec.c')
-rw-r--r--libavformat/img2dec.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index a20868cbaf..63de8fe752 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -606,8 +606,17 @@ static int bmp_probe(AVProbeData *p)
static int dpx_probe(AVProbeData *p)
{
const uint8_t *b = p->buf;
+ int w, h;
+ int is_big = (AV_RN32(b) == AV_RN32("SDPX"));
- if (AV_RN32(b) == AV_RN32("SDPX") || AV_RN32(b) == AV_RN32("XPDS"))
+ if (p->buf_size < 0x304+8)
+ return 0;
+ w = is_big ? AV_RB32(p->buf + 0x304) : AV_RL32(p->buf + 0x304);
+ h = is_big ? AV_RB32(p->buf + 0x308) : AV_RL32(p->buf + 0x308);
+ if (w <= 0 || h <= 0)
+ return 0;
+
+ if (is_big || AV_RN32(b) == AV_RN32("XPDS"))
return AVPROBE_SCORE_EXTENSION + 1;
return 0;
}