Skip to content
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

Extend transformations when extracting variables #687

Open
smeyer198 opened this issue Aug 6, 2024 · 0 comments
Open

Extend transformations when extracting variables #687

smeyer198 opened this issue Aug 6, 2024 · 0 comments
Labels
introduction Good issue to get introduced to the project

Comments

@smeyer198
Copy link
Contributor

#683 added required components to extract transformed values. On a high level, new Boomerang queries are triggered to collect all required values and then corresponding operations are executed to determine the correct values. For example, consider the following statement:

KeyGenerator kg = KeyGenerator.getInstance("AES".replace("A", "D");

Boomerang transforms this statement to

varReplacer0 = "A"
varReplacer1 = "D";
s1 = "AES"
s2 = s1.replace(varReplacer0, varReplaver1)
kg = staticInvoke.<getInstance(s2)>

Since getInstace is part of a rule and depends on a constraint, the ExtractParameterAnalysis triggers a Boomerang query to extract the parameter s2. Since s2 is not a concrete value (i.e. a constant or new expression), it cannot extract the correct value directly. The transformation components extend this query by triggering new queries to compute relevant variables, performs the operation replace with the collected value, and returns the result as allocation site. In total, the following steps are done:

  • Trigger a Backward query Q(getInstace(s2), s2)
  • At s2 = s1.replace(varReplacer0, varReplaver1), trigger the queries Q(s2 = s1.replace(varReplacer0, varReplaver1), s1), Q(s2 = s1.replace(varReplacer0, varReplaver1), varReplacer0), and Q(s2 = s1.replace(varReplacer0, varReplaver1), varReplacer1).
  • With the extracted values s1, varReplacer0, and varReplacer1, perform the operation s1.replace(varReplacer0, varReplaver1), giving the result DES
  • Return the value DES as result for the original query Q(getInstace(s2), s2)

Currently, the transformations for Integer.parseInt, String.replace, String.toCharArray, String.getBytes, BigInteger.valueOf, Array.length, Hex.decode, String.toUpperCase, and String.toLowerCase are implemented.

Tasks:

  • Think of further transformations for Strings, Wrappers (e.g. Integer, Double) and other transformations like + or - for integers.
  • Implement the transformations

Obsoletes #269

@schlichtig schlichtig added the introduction Good issue to get introduced to the project label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
introduction Good issue to get introduced to the project
Projects
None yet
Development

No branches or pull requests

2 participants