[FFmpeg-devel] [PATCH] Store Major brand, Minor version and compatible brands of a mov file using the metadata API
Wed Sep 9 13:00:47 CEST 2009
On Wed, Sep 9, 2009 at 1:18 PM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de>wrote:
> On Wed, Sep 09, 2009 at 12:44:00AM -0700, Baptiste Coudurier wrote:
> > On 09/09/2009 12:03 AM, haim alon wrote:
> > > Since we are dealing with string (4 characters) I think using the
> strlcpy is
> > > more suitable.
> > > This also inserts the NULL terminator at the end of the destination
> > We are dealing with uint32_t here, and you are reading one byte too much.
> No, at least av_strlcpy reads at most "size-1" bytes, 4 in this case.
> The problem is with the return value of it:
> return len + strlen(src) - 1;
> So my suggestion to replace strncpy with av_strlcpy actually completely
> broke things, (av_)strlcpy can only be used for correctly 0-terminated
> strings, and I fear that this is used wrongly in some places in
> FFmpeg, e.g. rtmppkt.c looks suspicious.
Why there is a problem with the return value?
In this case, it copies 4 characters from the source uint32_t and then add
If the source contains '\0', it copies only the characters before the NULL
(less than 4) and terminates it with NULL.
What is your suggestion?
By the way, I've tried using AV_WB32 instead but it swapped the characters.
Maybe AV_WL32 should be used.
Attached an updated patch with the improved styling.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2742 bytes
Desc: not available
More information about the ffmpeg-devel