bmv: check for len being valid in bmv_decode_frame().

It can be 0 or -1 for invalid files, which may result in invalid memory
access.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
pull/21/head
Anton Khirnov 12 years ago
parent 8d617b11cf
commit b88f902125
  1. 2
      libavcodec/bmv.c

@ -135,7 +135,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame,
mode += 1 + advance_mode; mode += 1 + advance_mode;
if (mode >= 4) if (mode >= 4)
mode -= 3; mode -= 3;
if (FFABS(dst_end - dst) < len) if (len <= 0 || FFABS(dst_end - dst) < len)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
switch (mode) { switch (mode) {
case 1: case 1:

Loading…
Cancel
Save