[FFmpeg-devel] Fwd: [PATCH] Psygnosis YOP demuxer

Michael Niedermayer michaelni
Sun Dec 27 05:33:38 CET 2009


On Sat, Dec 26, 2009 at 11:22:15PM +0530, Mohamed Naufal wrote:
> 2009/12/26 Diego Biurrun <diego at biurrun.de>
[...]
> +static int yop_probe(AVProbeData *probe_packet)
> +{
> +    if (AV_RB16(probe_packet->buf) == AV_RB16("YO") &&
> +        probe_packet->buf[6] && probe_packet->buf[7] &&
> +        !(AV_RL16(probe_packet->buf + 8) & 1) && !(AV_RL16(probe_packet->buf + 10) & 1))
> +        return AVPROBE_SCORE_MAX / 2 + 1;

does this pass probetest?


[...]

> +
> +    if ((ret = get_buffer(pb, video_dec->extradata, 8)) != 8)
> +        return -1;
> +

> +    yop->num_pal_colors     = video_dec->extradata[0];
> +    yop->sound_chunk_length = AV_RL16(video_dec->extradata + 6);

these should be checked to be smaller than frame_size


[...]
> +static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +    YopDecContext *yop = s->priv_data;
> +    ByteIOContext *pb  = s->pb;
> +
> +    int ret;
> +    int palette_size           = 4 + yop->num_pal_colors * 3;
> +    int actual_video_data_size = yop->frame_size -
> +                                 yop->sound_chunk_length - palette_size;
> +
> +    yop->stream ^= 1;
> +
> +    if (!yop->stream) {
> +        ret = av_new_packet(&yop->video_packet,
> +                            yop->frame_size - yop->sound_chunk_length);
> +        if (ret < 0)
> +            return ret;
> +
> +        yop->video_packet.pos = url_ftell(pb);
> +        ret = get_buffer(pb, yop->video_packet.data, palette_size);
> +        if (ret < 0) {
> +            return ret;
> +        } else if (ret < palette_size) {
> +            yop_free_packets(yop);

double free


> +            return AVERROR_EOF;
> +        }
> +
> +        // 1840 samples per frame, 1 nibble per sample; hence 1840/2 = 920
> +        ret = av_get_packet(pb, &yop->sound_packet, 920);
> +        if (ret < 920) {
> +            yop_free_packets(yop);
> +            return AVERROR_EOF;
> +        }
> +

> +        url_fskip(pb, yop->sound_chunk_length - 920);

missing check that sound_chunk_length >= 920


[...]
> +AVInputFormat yop_demuxer = {
> +    "yop",
> +    NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
> +    sizeof(YopDecContext),
> +    yop_probe,
> +    yop_read_header,
> +    yop_read_packet,
> +    .extensions = "yop",

missing code to free packets


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091227/b0e9bc4b/attachment.pgp>



More information about the ffmpeg-devel mailing list