[kaffe] weird GC error with bad class format

Timothy Stack stack@cs.utah.edu
Mon Feb 3 13:29:02 2003


> Hi everyone.

hi,

> i'm currently modifying kaffe's verifier (not posted yet because i'm
> trying to get it more or less bug-for-bug compatible with Sun...they don't
> really follow their own damn spec too closely, it turns out) and class
> loader to take advantage of a GJ-like signature for running generic code
> faster.

Could you post it anyways?  Itd be nice to take a look at it.

> the problem comes when the GJ Signature attribute is malformed.  the
> method readAttribute() in readClass.c returns false, and
> 
>    kaffe-bin: mem/gc-incremental.c:1064: gcFree: Assertion `!!!"Attempt to
>               explicitly free nonfixed object"' failed.
> 
> is what i get.

So, I'm not seeing this, could you use gdb and give us a back trace?  I am
seeing another error though, libraries/clib/native/SystemClassLoader.c has
a broken conditional:

	if (!strcmp(info.classname, "java.lang.NoClassDefFoundError")) {
	...
	}
	else if ((info.type & KERR_EXCEPTION)
		&& !strcmp(info.classname, "java.lang.NoClassDefFoundError"))
	{

	}

It looks like patch just messed up, the second 'if' is the correct
conditional, but its block is empty.  So, the block should be deleted and
the conditional moved up:

	if ((info.type & KERR_EXCEPTION)
                && !strcmp(info.classname, "java.lang.NoClassDefFoundError"))
        {
	...
	}


> this is bad because that means whenever a class file is
> corrupted a little bit (or at least the attributes in a class file are
> corrupted) and readAttribute returns false, this pretty bad thing happens.
> 
> to reproduce this, simply add the following case to readAttribute:
> 
> 	else if (!strcmp(name->data, "Signature")) {
>                                 return false;
>         }

Are you using the current CVS?

> cheers,
> ~rob

tim stack