Re: glib bug



Havoc Pennington wrote:
> 
> Darin Fisher <dfisher jagger me berkeley edu> writes:
> > The problem is that %G is not a valid format sequence.  If you
> > change it to %g then the program works as expected.
> >
> 
> %G should be valid, I think it's a real glib bug.
> 
> Havoc

You're right.  The %G is supposed to be valid, and moreover it is
quite different from %g.  There are actually a number of format
flags unsupported by g_printf_string_upper_bound (eg. %F).  Right
now, the occurance of an unknown format sequence is not correctly
handled (obviously, since it's crashing), and what is needed is
a "good" catch all for unknown format sequences.  Maybe it could
just add 64 bytes to the buffer size or something like that.  At
the very least it should flag done=TRUE, so that the code will 
not pick up the next character and try to use it as the format
sequence.

I think the fix would be quite small:

In gstrfuncs.c, on line 920, insert the following into the default case:

   len += 64;
   done = TRUE;

I'm not really sure about the 64 bytes... is that too small or too
large?

Darin




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