gc crash caused by improper use of GC_general_register_disappearing_link

Andrew Haley aph@redhat.com
Mon Nov 15 18:56:00 GMT 2004


OK, I'll do this.  GC_find_header is private.

Andrew.

2004-11-15  Andrew Haley  <aph@redhat.com>

	* boehm.cc (_Jv_GCRegisterDisappearingLink): Check that *objp
	is a gc-allocated object.

Index: boehm.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/boehm.cc,v
retrieving revision 1.42.12.10
diff -p -2 -c -w -r1.42.12.10 boehm.cc
*** boehm.cc	25 Oct 2004 17:23:48 -0000	1.42.12.10
--- boehm.cc	15 Nov 2004 16:21:45 -0000
*************** void
*** 690,693 ****
--- 690,697 ----
  _Jv_GCRegisterDisappearingLink (jobject *objp)
  {
+   // This test helps to ensure that we meet a precondition of
+   // GC_general_register_disappearing_link, viz. "Obj must be a
+   // pointer to the first word of an object we allocated."
+   if (GC_base(*objp))
      GC_general_register_disappearing_link ((GC_PTR *) objp, (GC_PTR) *objp);
  }



More information about the Java mailing list