[FFmpeg-devel] camera files (no name)

Michael Niedermayer michaelni
Fri Feb 6 18:20:50 CET 2009


On Fri, Feb 06, 2009 at 08:14:30AM -0500, nicolas martin wrote:
>
>> On Wed, Feb 04, 2009 at 01:23:16PM -0500, nicolas martin wrote:
>>>
>>>> On Tue, Feb 03, 2009 at 04:27:51PM -0500, nicolas martin wrote:
>>>>> Attached is a patch to support the nc4600 camera files.
>>>>>
>>>>> Thanks in advance for reviewing and replying.
>>>>
>>>> Changelog and docs update is missing.
>>>
>>> Doc update and changelog since when ?
>>
>> If you add a new demuxer, you should add an entry for it to the
>> changelog and the format support list in doc/general.texi.
>>
>
> In reply to what Peter Ross wrote, I can't find its mail though
>
>>> > + if (size <= 0) {
>>> > + av_log(s, AV_LOG_DEBUG, "Wrong size : %d\n", size);
>>> While size may be zero, it will never be less then zero, thus the debug 
>>> statement is pointless.
> The size can't be less than zero, I changed it.
> However if the size is zero, then we have a problem, so the debug statement 
> is meaningful.

[...]
> +static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
> +{
> +    int size;
> +
> +    uint32_t state=-1;
> +    while(!url_feof(s->pb) && state != NC_VIDEO_FLAG)
> +        state = (state<<8) + get_byte(s->pb);
> +
> +    get_byte(s->pb);
> +    size = get_le16(s->pb);
> +    url_fskip(s->pb, 9);
> +

> +    if (size == 0) {
> +        av_log(s, AV_LOG_DEBUG, "Wrong size : %d\n", size);
> +        return AVERROR_INVALIDDATA;
> +    }

what is the problem with not returning an error in this case?


> +
> +    if (av_get_packet(s->pb, pkt, size) != size)
> +        return AVERROR(EIO);

if the return is >0 but != size then this leaks a packet


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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20090206/929285f8/attachment.pgp>



More information about the ffmpeg-devel mailing list