-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roundtrip Bytecode Modification fails when using ba.LabeledCode
#242
Comments
Sadly I don't have much insight into the abstract interpretation code. Can you give me some hints where that ReferenceValue method is called from? If that method really leads to this, that seems strange. In that case, this would also produce an Difficult to say where the underlying problem is. Could be a mixin issue with the two domains, but could also be wrong implementation in either. Especially |
Sure i can try to give you some context on this:
I again confirmed via debugging that this in fact calls
This comment seems to specifically acknowledge that value can be null here, but the actual implementation in |
Note that the code we're discussing about is from this commit and unchanged since then. Interestingly, here, code in |
During the current iteration of our project course on static program analysis, one of our students discovered what i believe is a bug in abstract interpretation. The students were working on a task where they had to change bytecode of certain methods, and then write the modified bytecode to files. I know there is multiple ways to do this, but one way that seems particularly suited is the
org.opalj.ba.LabeledCode
builder. However, students discovered that the simple round-trip of reading code and writing it again without modifications usingLabeledCode
does not work for all methods of real-world projects. For example, it fails on 4% of all methods from Apaches PDFBox 3.0.3 (link to jar). Here is an example that exercises a specific method for which the roundtrip fails:The exception that is thrown is very long and very detailed (pdfbox-error.txt), but boils down to the following:
StackMapTable
for the code (see here)forward
) can very well benull
.CodeAttributeBuilder
uses theorg.opalj.ai.domain.l0.TypeCheckingDomain
to detect dead code via Abstract Interpretation. For some reason, this domain believes that fields of a class are always initialized and can never be null (at least that's what i got from some detailed debugging through the above-mentioned example). Specifically, this method is called to generate a domain value for a field access, which results in a call to this method returning anInitializedObjectValue
.@errt do you have any insights into this? Is the
LabeledCode
object intended to be used this way, did we do something not supported or is this actually a bug? If so, i'd look into it in the coming days.Credit to Finn for reporting this issue 👍
The text was updated successfully, but these errors were encountered: