[Soot-list] soot-classpath troubles

Patrick Lam plam at sable.mcgill.ca
Tue Aug 15 13:47:36 EDT 2006


Dan Grossman wrote:
> So I imagine somebody somewhere didn't convert slashes to dots eagerly
> enough.  I can change RefType.v to replace slashes with dots, but is
> that the Right Thing To Do?

Hi Dan,

It looks like a Coffi bug to me.  The Java VM spec says that class names
in class files are slashified instead of dotified, and
soot.coffi.CFG.processCPEntry doesn't do any conversion.  It sounds to
me like RefType ought to assume that its input is dotified, not slashified.

It's strange that this bug hasn't been triggered or reported before, though.

Sounds like this problem might not happen if you converted to jimple
first and then parsed from there.  Actually, you'd only need to jimplify
the reference to java.io.BufferedInputStream and see if that jimple file
is correct, and then parse the whole program with --src-prec=jimple.

...

Aha.  Ondrej has already committed a fix to this:

r2446 | olhota | 2006-06-22 09:31:31 -0400 (Thu, 22 Jun 2006) | 4 lines

Bug fix: When reading classconstants in Java 5, Coffi would create RefTypes
containing slashes instead of dots. Fix contributed by Nicolae Vintila.

It's exactly the same fix I just came up with, so it should be fine.
Here's the diff:

Index: coffi/CFG.java
===================================================================
--- coffi/CFG.java      (revision 2364)
+++ coffi/CFG.java      (working copy)
@@ -2717,6 +2717,7 @@
         else if (c instanceof CONSTANT_Class_info){
             CONSTANT_Class_info info = (CONSTANT_Class_info)c;
             String name = ((CONSTANT_Utf8_info)
(constant_pool[info.name_index])).convert();
+            name = name.replace('/', '.')
             if (name.charAt(0) == '['){
                 int dim = 0;
                 while (name.charAt(dim) == '['){

pat


More information about the Soot-list mailing list