Red Hat Bugzilla – Bug 235733
g_utf8_validate() failed to allocate 4294967296 bytes
Last modified: 2007-11-30 17:12:01 EST
Description of problem:
Using g_utf8_validate() with param length set as -1 cause the following terror
GLib-ERROR **: gmem.c:172: failed to allocate 4294967296 bytes
Looks like -1 is interpreted as an unsigned, thus the 4294967296
The API of g_utf8_validate() says:
max_len : max bytes to validate, or -1 to go until NUL
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Just use the following call in g_utf8_validate (string, -1, NULL)
This works as expected on other x86_64 distributions like Ubuntu or Debian.
Never mind, I cannot reproduce that problem with a simple test case, so it's
something else. Sorry for the false alarm...
My guess would be you were calling g_utf8_validate without including the right
header with a prototype. Without a prototype, -1 will be passed as
0xffffffffUL in the corresponding register, while -1L or with a prototype
which has long type for the parameter as -1L (== 0xffffffffffffffffL).