Skip to content

Crash when using jdbc extension function REPLICATE #1268

@suyZhong

Description

@suyZhong

Describe the bug
A fatal error has been detected by the Java Runtime Environment. SQLite exits with SIGSEGV. SQLite originally does not support REPLICATE, so I suppose there might be some issue in sqlite-jdbc.

To Reproduce

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Reproduce {
    public static void main(String[] args) {
        try (Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:");) {
            Statement statement = connection.createStatement();
            statement.executeUpdate("CREATE TABLE  t0(c0 FLOAT, c1 INT DEFAULT (ABS(-1)), PRIMARY KEY(c0))");
            statement.executeUpdate("INSERT INTO t0(c1, c0) VALUES (582293937, '^?V%'), ('73056190', '^')");
            
            ResultSet rs = statement.executeQuery(
                    "SELECT * FROM t0 RIGHT  JOIN  (SELECT 2025567911 AS col0 FROM t0 WHERE ((0.57721)<(t0.c0))) AS sub0  ON REPLICATE(sub0.col0, t0.c1)");
            while (rs.next()) {
                // read the result set
            }
        } catch (SQLException e) {
            e.printStackTrace(System.err);
        }
    }
}

then

javac Reproduce.java
java -classpath ".:sqlite-jdbc-3.49.1.0.jar" Reproduce

Expected behavior
Raise an exception or return a result.

Logs
If applicable, provide logs.

Environment (please complete the following information):

  • OS: Ubuntu 22.04
  • CPU architecture: x86_64
  • sqlite-jdbc version 3.49.1.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions