[FFmpeg-devel] [PATCH] lavu/avstring: add av_get_utf8() function

Stefano Sabatini stefasab at gmail.com
Thu Nov 14 20:52:08 CET 2013


On date Thursday 2013-11-14 18:42:31 +0100, Stefano Sabatini encoded:
> On date Thursday 2013-11-14 15:35:45 +0100, Nicolas George encoded:
> > Le quartidi 24 brumaire, an CCXXII, Stefano Sabatini a écrit :
> > > Suppose that you have an overflow with PTR+1, then you have PTR+1=0 <
> > > PTR, in this case the code will misbehave. I don't know if the specs
> > > explicitly allow this (PTR+1 for every allocated byte pointer should
> > > not overflow).
> > 
> > I am pretty sure the standard implies that if PTR points to an object, then
> > PTR+1 can not overflow. Which, in practical cases, means than (type *)-1 can
> > never be dereferenced.
> 
> Yes, so it seems:
> 
>     C99 6.5.8/5 Relational operators
> 
>     If the expression P points to an element of an array object and
>     the expression Q points to the last element of the same array
>     object, the pointer expression Q+1 compares greater than P. In all
>     other cases, the behavior is undefined.
> 
> > 
> > > >From 7fb8c0f07de33428f3050161e58bb9bb666f6f5e Mon Sep 17 00:00:00 2001
> > > From: Stefano Sabatini <stefasab at gmail.com>
> > > Date: Thu, 3 Oct 2013 01:21:40 +0200
> > > Subject: [PATCH] lavu/avstring: add av_utf8_decode() function
> > > 
> > > ---
> > >  doc/APIchanges       |  3 +++
> > >  libavutil/Makefile   |  1 +
> > >  libavutil/avstring.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  libavutil/avstring.h | 40 +++++++++++++++++++++++++++++++
> > >  libavutil/utf8.c     | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  libavutil/version.h  |  2 +-
> > >  6 files changed, 175 insertions(+), 1 deletion(-)
> > >  create mode 100644 libavutil/utf8.c

Updated.

Unsure if I should add another macro ACCEPT_ALL which would overrides
all the other flags and disable range checks (useful for testing
purposes).

Another interface optimization would be to document that *code is set
whenever the sequence is structurally valid, even if the code range is
not accepted.
-- 
FFmpeg = Friendly Frenzy Most Puritan Elaborated Game
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-avstring-add-av_utf8_decode-function.patch
Type: text/x-diff
Size: 8397 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131114/d5448c60/attachment.bin>


More information about the ffmpeg-devel mailing list