Commit 80f798b4 by Tom Tromey Committed by Tom Tromey

re PR classpath/23863 (mprec buffer overwrite bug)

	PR classpath/23863:
	* native/fdlibm/dtoa.c (_dtoa): Free contents of _Jv_reent when
	finished.
	* native/fdlibm/mprec.c: New version from newlib.  Commented out
	some includes.  Added <assert.h>.
	(_reent, _Bigint): New defines.
	(_REENT_CHECK_MP, _REENT_MP_FREELIST, _REENT_MP_P5S): Likewise.
	(__ULong, __Long): New types.
	(_calloc_r): New function.
	(Balloc): Dynamically add new _freelist entries as needed.
	* native/fdlibm/mprec.h (struct _Jv_Bigint): Don't use
	MAX_BIGNUMS to size _x[].
	(struct _Jv_reent): _freelist now a _Jv_Bigint**.  Removed
	_allocation_map, num.  Added _max_k.

From-SVN: r114511
parent 02440ca4
2006-06-09 Tom Tromey <tromey@redhat.com>
PR classpath/23863:
* native/fdlibm/dtoa.c (_dtoa): Free contents of _Jv_reent when
finished.
* native/fdlibm/mprec.c: New version from newlib. Commented out
some includes. Added <assert.h>.
(_reent, _Bigint): New defines.
(_REENT_CHECK_MP, _REENT_MP_FREELIST, _REENT_MP_P5S): Likewise.
(__ULong, __Long): New types.
(_calloc_r): New function.
(Balloc): Dynamically add new _freelist entries as needed.
* native/fdlibm/mprec.h (struct _Jv_Bigint): Don't use
MAX_BIGNUMS to size _x[].
(struct _Jv_reent): _freelist now a _Jv_Bigint**. Removed
_allocation_map, num. Added _max_k.
2006-05-30 Thomas Fitzsimmons <fitzsim@redhat.com>
* native/jni/gtk-peer/Makefile.am (gcc_version): New variable.
......
......@@ -2,7 +2,7 @@
*
* The author of this software is David M. Gay.
*
* Copyright (c) 1991 by AT&T.
* Copyright (c) 1991, 2006 by AT&T.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
......@@ -897,10 +897,23 @@ _DEFUN (_dtoa,
{
struct _Jv_reent reent;
char *p;
int i;
memset (&reent, 0, sizeof reent);
p = _dtoa_r (&reent, _d, mode, ndigits, decpt, sign, rve, float_type);
strcpy (buf, p);
return;
for (i = 0; i < reent._result_k; ++i)
{
struct _Jv_Bigint *l = reent._freelist[i];
while (l)
{
struct _Jv_Bigint *next = l->_next;
free (l);
l = next;
}
}
if (reent._freelist)
free (reent._freelist);
}
......@@ -282,7 +282,7 @@ struct _Jv_Bigint
{
struct _Jv_Bigint *_next;
int _k, _maxwds, _sign, _wds;
unsigned long _x[MAX_BIGNUM_WDS];
unsigned long _x[1];
};
......@@ -310,10 +310,8 @@ struct _Jv_reent
int _result_k;
struct _Jv_Bigint *_p5s;
struct _Jv_Bigint _freelist[MAX_BIGNUMS];
int _allocation_map;
int num;
struct _Jv_Bigint **_freelist;
int _max_k;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment