[FFmpeg-devel] [PATCH] dfa: implement tdlt chunk decoding

Michael Niedermayer michaelni at gmx.at
Sun Apr 7 21:42:54 CEST 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130407/308b8987/attachment.asc>


More information about the ffmpeg-devel mailing list