Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 235733 - g_utf8_validate() failed to allocate 4294967296 bytes
g_utf8_validate() failed to allocate 4294967296 bytes
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2007-04-09 16:24 EDT by Olivier Fourdan
Modified: 2007-11-30 17:12 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-04-10 01:47:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Olivier Fourdan 2007-04-09 16:24:02 EDT
Description of problem:

Using g_utf8_validate() with param length set as -1 cause the following terror
on x86_64:

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):


How reproducible:

Steps to Reproduce:
Just use the following call in  g_utf8_validate (string, -1, NULL)
Actual results:

Expected results:

Additional info:

This works as expected on other x86_64 distributions like Ubuntu or Debian.
Comment 1 Olivier Fourdan 2007-04-10 01:47:25 EDT
Never mind, I cannot reproduce that problem with a simple test case, so it's
something else. Sorry for the false alarm...
Comment 2 Jakub Jelinek 2007-04-13 06:49:46 EDT
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).

Note You need to log in before you can comment on or make changes to this bug.