[FFmpeg-devel] [PATCH] dfa: implement tdlt chunk decoding
Paul B Mahol
onemda at gmail.com
Mon Apr 8 01:03:04 CEST 2013
On 4/7/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Apr 06, 2013 at 05:30:49PM +0000, Paul B Mahol wrote:
>> Sample & pseudo code provided by Vladimir "VAG" Gneushev.
>>
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>> libavcodec/dfa.c | 23 +++++++++++++++++++----
>> 1 file changed, 19 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
>> index fcfcd30..a048dd6 100644
>> --- a/libavcodec/dfa.c
>> +++ b/libavcodec/dfa.c
>> @@ -288,9 +288,24 @@ static int decode_wdlt(GetByteContext *gb, uint8_t
>> *frame, int width, int height
>> return 0;
>> }
>>
>> -static int decode_unk6(GetByteContext *gb, uint8_t *frame, int width, int
>> height)
>> +static int decode_tdlt(GetByteContext *gb, uint8_t *frame, int width, int
>> height)
>> {
>> - return AVERROR_PATCHWELCOME;
>> + const uint8_t *frame_end = frame + width * height;
>> + uint32_t segments = bytestream2_get_le32(gb);
>> +
>> + while (segments--) {
>> + int count = bytestream2_get_byte(gb) << 1;
>> + int skip = bytestream2_get_byte(gb) << 1;
>> +
>
>> + frame += skip;
>> + if (frame_end - frame < count)
>> + return AVERROR_INVALIDDATA;
>
> should probably be: (unless i miss something)
>
> + if (frame_end - frame < count + skip)
> + return AVERROR_INVALIDDATA;
> + frame += skip;
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> During times of universal deceit, telling the truth becomes a
> revolutionary act. -- George Orwell
>
applied
More information about the ffmpeg-devel
mailing list