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

SQLite fails to load due to "java.lang.NoSuchMethodError: Lorg/sqlite/Collation;.xCompare(Ljava/lang/String;Ljava/lang/String;)I]" #31

Closed
leeN opened this issue Aug 28, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@leeN
Copy link
Collaborator

leeN commented Aug 28, 2024

SQLite expects org/sqlite/Collation to have a xCompare(String, String) method. This allows to use Java methods to define collations, like this:

Class. forName("org. sqlite. JDBC");
Connection conn = DriverManager. getConnection("jdbc:sqlite:");
 
Collation. create(conn, "REVERSE", new Collation() {
  protected int xCompare(String str1, String str2) {
    return str1.compareTo(str2) * -1;
  }
});
 
conn. createStatement().execute("select c1 from t order by c1 collate REVERSE;");

The existence of this method is checked during loading the sqlite native library. Fontus rewrites this method to be taint-aware, causing the error above.

Slightly curious how we did not hit that before..

@leeN leeN added the bug Something isn't working label Aug 28, 2024
@leeN leeN self-assigned this Aug 28, 2024
@leeN
Copy link
Collaborator Author

leeN commented Aug 28, 2024

As we don't have any possibility to detect this at instrumentation time, we have to implement a workaround. Solution would be to special case sqlite in the Instrumenter to add proxies that call the implemented xCompare methods.

@leeN
Copy link
Collaborator Author

leeN commented Aug 29, 2024

Fixed in a61a712

@leeN leeN closed this as completed Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant