[kaffe] PATCH: check range before calling sub_int_const

Casey Marshall rsdio@metastatic.org
Tue Mar 9 16:07:02 2004


--=-=-=

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This fixes the issue I posted about earlier, that causes a segfault in
`translate'. Without this, sub_int and sub_int_const will recursively
call each other. Which is bad.

2004-03-09  Casey Marshall <rsdio@metastatic.org>

	* kaffe/kaffevm/jit3/icode.c:
        (sub_int): call `HAVE_sub_int_const_rangecheck' before calling
        `sub_int_const'.

- -- 
Casey Marshall || rsdio@metastatic.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>

iD8DBQFATlukgAuWMgRGsWsRAl6LAJ9A2e7gfGy+UV27Dc1NiTFsaP5IogCggOMg
nnkThgsLY2mWxU5W2Cf1gtw=
=A2PT
-----END PGP SIGNATURE-----

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=sub_int.patch

Index: kaffe/kaffevm/jit3/icode.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/jit3/icode.c,v
retrieving revision 1.34
diff -u -r1.34 icode.c
--- kaffe/kaffevm/jit3/icode.c	11 Oct 2003 20:45:50 -0000	1.34
+++ kaffe/kaffevm/jit3/icode.c	9 Mar 2004 23:59:24 -0000
@@ -1169,7 +1169,7 @@
 sub_int(SlotInfo* dst, SlotInfo* src, SlotInfo* src2)
 {
 #if defined(HAVE_sub_int_const)
-	if (slot_type(src2) == Tconst) {
+	if (slot_type(src2) == Tconst && HAVE_sub_int_const_rangecheck(slot_value(src2).i)) {
 		sub_int_const(dst, src, slot_value(src2).i);
 	}
 	else

--=-=-=--