[FFmpeg-devel] [PATCH] avio: add avio_get_str as a replacement for get_strz

Michael Niedermayer michaelni
Thu Mar 3 12:38:38 CET 2011


On Wed, Mar 02, 2011 at 04:09:48PM +0100, Anton Khirnov wrote:
> On Wed, Mar 02, 2011 at 01:42:42PM +0100, Michael Niedermayer wrote:
> > On Tue, Mar 01, 2011 at 06:33:56PM +0100, Anton Khirnov wrote:
> > > It's more flexible and compatible with avio_get_str16.
> > > ---
> > >  libavformat/avio.h    |   15 ++++++++++++++-
> > >  libavformat/aviobuf.c |   29 +++++++++++++++++++----------
> > >  libavformat/cafdec.c  |    4 ++--
> > >  libavformat/ffmdec.c  |    3 ++-
> > >  libavformat/mov.c     |    2 +-
> > >  5 files changed, 38 insertions(+), 15 deletions(-)
> > > 
> > > diff --git a/libavformat/avio.h b/libavformat/avio.h
> > > index cc46ad7..7e0dca0 100644
> > > --- a/libavformat/avio.h
> > > +++ b/libavformat/avio.h
> > > @@ -526,6 +526,14 @@ unsigned int avio_rl32(AVIOContext *s);
> > >  uint64_t     avio_rl64(AVIOContext *s);
> > >  
> > >  /**
> > > + * Read a UTF-8 string from pb. The reading will terminate when either
> > > + * a NULL character was encountered or maxlen bytes have been read.
> > 
> > This doesnt match the code, it does not mention zero termination behavior
> > for the truncated case
> > 
> > 
> > > + *
> > > + * @return number of bytes read (is always <= maxlen).
> > > + */
> > 
> > This is not very convenient
> > We rarely care about the length, but we often care about having truncated data
> > 
> 
> It's funny you say that, since the return value as it is now is used in
> this very patch (cafdec.c).

before this cosmetic patch the the cafdec.c code reads until a 0 byte or end of
buffer

after this cosmetic patch it reads until a 0 byte, the end of buffer or until
a previously unused size parameter.


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

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110303/75a934a9/attachment.pgp>



More information about the ffmpeg-devel mailing list