Bug 120493 - Endless loop during demangling
Endless loop during demangling
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
ia64 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-04-09 08:07 EDT by Eugeny Klementev
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-05-11 23:40:24 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 Eugeny Klementev 2004-04-09 08:07:44 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET 
CLR 1.1.4322)

Description of problem:
This example raise error:
#include <string.h>

extern "C" char* __cxa_demangle (const char*  mangled_name, char* 
output_buffer, size_t* length, int* status);

int main () {
	char name [4096];
	char buf [4096];
	size_t n = 0;
	int status = 0;

	strcpy (name, "xFixDestroyDataBlock");
	__cxa_demangle (name, buf, &n, &status);
	return 0;
There is endless loop in function __cxa_dyn_string_resize.
dyn_string_resize (ds, space)
     dyn_string_t ds;
     int space;
  int new_allocated = ds->allocated;

  /* Increase SPACE to hold the NUL termination.  */

  /* Increase allocation by factors of two.  */
  while (space > new_allocated)
    new_allocated *= 2;
The value os new_allocated is 0 and execution cannot be out of while 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Example from description

Additional info:
Comment 1 Jakub Jelinek 2004-04-14 08:49:30 EDT
Your testcase is flawed, buf if not NULL must be allocated by malloc
or realloc, see
But it loops even if the buffer is really malloced and there is another
bug in that it fails when status == NULL, which it should not.

Note that RHL 8.0 is no longer supported, so changing this to RHEL3.
Comment 2 Jakub Jelinek 2004-04-15 18:51:42 EDT
Please try
Comment 3 John Flanagan 2004-05-11 23:40:24 EDT
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.


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