[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NullPointerException in Soot (soot.coffi.CFG)
>>>>> "arudys" == Algis Rudys <arudys@cs.rice.edu> writes:
arudys> Greetings --
arudys> This was reported earlier on this list; here's a concrete case:
>> From Sun JDK for Linux build 1.4.1_01-b01, method
arudys> <sun.rmi.transport.proxy.RMIMasterSocketFactory$AsyncConnector: void run()>
arudys> I get:
arudys> Exception in thread "main" java.lang.NullPointerException
arudys> at java.util.Hashtable.get(Hashtable.java:329)
.
.
.
arudys> The exception table entry that triggers it is the
arudys> first one added (the below is the list of exception table
arudys> entries as they are processed by adjustExceptionTable()).
.
.
.
arudys> null 144 34
arudys> ^^^^
arudys> Oddly, the startpc associated with this entry is 0.
Coincidentally, I sent a proposed patch to the first reporter of
the bug last night (the patch is appended). He has yet to tell
me if it fixes the problem he encountered.
That null you spotted is indeed the key to the problem. I
introduced this bug last summer, when I modified soot.coffi.CFG
to fix another bug that manifested itself when the protected area
of an exception partially overlaps an inlined subroutine. I dealt
with the problem by comparing the bytecode indexes of the
subroutine being inlined with the bytecode indexes of the
protected area (seems pretty obvious in retrospect), but I made
the mistake of taking the index for the beginning of the inlined
code from the first instruction cloned for inlining, which
doesn't work when the inlined subroutine is empty, as it is for
sun.rmi.transport.proxy.RMIMasterSocketFactory$AsyncConnector.run()
Here's the patch.
--- soot-2.1.0/src/soot/coffi/CFG.java 2003-12-18 11:43:05.000000000 -0600
+++ soot-2.1.0-patched/src/soot/coffi/CFG.java 2004-02-16 23:22:55.000000000 -0600
@@ -735,7 +735,7 @@
LinkedList newentries = new LinkedList();
- int orig_start_of_subr = headbefore.next.originalIndex; // inclusive
+ int orig_start_of_subr = astore.next.originalIndex; // inclusive
int orig_end_of_subr = ret.originalIndex; // again, inclusive
for (int i=0; i<ca.exception_table_length; i++)