summaryrefslogtreecommitdiff
path: root/libavcodec/dfa.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-10 12:41:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-10 12:41:06 +0200
commit0594ef0deab75ad1fdf92548b907079659ce50f5 (patch)
tree0d879a36db6b0d0c466cda49ff04a1dd1fd1899f /libavcodec/dfa.c
parent2a7f885fe1cfaaefe35252d68366d0d5709cd745 (diff)
parentb439c992c23f3e0f3832fffd2a34a664b236c525 (diff)
Merge commit 'b439c992c23f3e0f3832fffd2a34a664b236c525'
* commit 'b439c992c23f3e0f3832fffd2a34a664b236c525': lavfi: switch to an AVOptions-based system. dfa: implement missing TDLT coding method Conflicts: libavcodec/dfa.c libavfilter/avfilter.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dfa.c')
-rw-r--r--libavcodec/dfa.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 4c77f4e273..32459098a7 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -292,17 +292,19 @@ static int decode_tdlt(GetByteContext *gb, uint8_t *frame, int width, int height
{
const uint8_t *frame_end = frame + width * height;
uint32_t segments = bytestream2_get_le32(gb);
+ int skip, copy;
while (segments--) {
- int count = bytestream2_get_byte(gb) << 1;
- int skip = bytestream2_get_byte(gb) << 1;
-
- if (frame_end - frame < skip + count)
+ if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
- frame += skip;
- if (bytestream2_get_buffer(gb, frame, count) != count)
+ copy = bytestream2_get_byteu(gb) * 2;
+ skip = bytestream2_get_byteu(gb) * 2;
+ if (frame_end - frame < copy + skip ||
+ bytestream2_get_bytes_left(gb) < copy)
return AVERROR_INVALIDDATA;
- frame += count;
+ frame += skip;
+ bytestream2_get_buffer(gb, frame, copy);
+ frame += copy;
}
return 0;