Crashing g_string_sprintf when printing invalid floats. gtk+-1.2.9 on Linux



All,

I am seeing a crash, although with GLib error message, when printing a floating point number.

The error message is that GLib is unable to allocate -7 bytes. Which seems reasonable enough.

The problem is that the data I am trying to print does not seem to be a valid floating point number. My program needs to be crash-proof in this case, as bad data is going to be encountered. I see that the value that is bad is typically something like "6.0245e-44", which is not valid.

The fact that I can read the value means that ddd/gdb is handling it properly, but not g_string_sprintf.

Any clues? Any suggestions as to how to clamp the floating point value? I have tried to do so with comparisons to MAX_FLT and MIN_FLT, without success.

As an aside, the problem has never been observed when using the Solaris version of the program, just the Linux one.

Thanks in advance,


Eric Monsler




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