RE: glib's g_logv 1024 byte maximum character array



On 25 Jul 2003, Matthias Clasen wrote:

> Am Don, 2003-07-24 um 10.22 schrieb martyn 2 russell bt com:
> > > it's not a bug. if you actually take a look at gmessage.c, it says:
> > >
> > >   /* we use a stack buffer of fixed size, because we might get called
> > >    * recursively.
> > >    */
> > >   _g_vsnprintf (buffer, 1024, format, args1);
> > >
> >
> > Yes I did take a look at this, and yes, I know that is why there is a limit
> > (to protect against recursion), BUT!! The bug is that when a string has
> > NOTHING but multibyte characters, at some point, you are bound to have
> > invalid UTF8 string if you ALWAYS cut of at the 1024th byte.  Checking for
> > multibyte characters first is needed.
> >
> > Yes, there has to be a limit to the buffer which is used, but, for something
> > as well used as the g_log() functions, it would be better if there was no
> > limit similar to the way an unlimited string arguments can be used with
> > g_strdup_printf() as you quite rightly pointed out.
> >
> > I do not know the mechanics of the g_log() functions or implications if
> > g_strdup_printf() could be utilised (this is a good suggestion though), :)
> > perhaps that would solve the problem?
> >
>
> Here is a patch to remove the string length limitation in the
> non-recursive case. Ok to commit, Tim ?

yes, thanks. looks good to me.

---
ciaoTJ




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]