Bug 120493 - Endless loop during demangling
Endless loop during demangling
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
3.0
ia64 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2004-05-11 23:40:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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.
Source:
------------------------
dyn_string_t
dyn_string_resize (ds, space)
     dyn_string_t ds;
     int space;
{
  int new_allocated = ds->allocated;

  /* Increase SPACE to hold the NUL termination.  */
  ++space;

  /* 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 
loop.

Version-Release number of selected component (if applicable):
libstdc++-3.2-29

How reproducible:
Always

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
http://www.codesourcery.com/cxx-abi/abi.html#demangler
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
ftp://people.redhat.com/jakub/gcc/errata/3.2.3-34/
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.

http://rhn.redhat.com/errata/RHBA-2004-142.html

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