Skip to content

Commit 512fee0

Browse files
Update sqlite-jdbc to 3.41.2.2 to address CVE-2023-32697 (#1667)
* Update sqlite-jdbc to 3.41.2.2 to address CVE-2023-32697 Signed-off-by: MaxKsyunz <[email protected]> * Don't check column names on H2 results for correctness tests as described in #1667 (comment). Signed-off-by: Yury-Fridlyand <[email protected]> * Address PR review comment. Signed-off-by: Yury-Fridlyand <[email protected]> --------- Signed-off-by: MaxKsyunz <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: Yury-Fridlyand <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]>
1 parent 6fe6c45 commit 512fee0

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

integ-test/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ dependencies {
9494
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2')
9595

9696
testImplementation group: 'com.h2database', name: 'h2', version: '2.1.214'
97-
testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
97+
testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.41.2.2'
9898
testImplementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
9999
}
100100

integ-test/src/test/java/org/opensearch/sql/correctness/runner/resultset/DBResult.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
import java.util.Collection;
1313
import java.util.Collections;
1414
import java.util.List;
15+
import java.util.Objects;
1516
import java.util.Set;
16-
import lombok.EqualsAndHashCode;
17+
import java.util.stream.Collectors;
1718
import lombok.Getter;
1819
import lombok.ToString;
1920
import org.json.JSONPropertyName;
@@ -24,7 +25,6 @@
2425
* query with SELECT columns or just *, order of column and row may matter or not. So the internal data structure of this
2526
* class is passed in from outside either list or set, hash map or linked hash map etc.
2627
*/
27-
@EqualsAndHashCode(exclude = "databaseName")
2828
@ToString
2929
public class DBResult {
3030

@@ -191,4 +191,24 @@ private static <T extends Comparable<T>> List<T> sort(Collection<T> collection)
191191
return list;
192192
}
193193

194+
public boolean equals(final Object o) {
195+
if (o == this) {
196+
return true;
197+
}
198+
if (!(o instanceof DBResult)) {
199+
return false;
200+
}
201+
final DBResult other = (DBResult) o;
202+
// H2 calculates the value before setting column name
203+
// for example, for query "select 1 + 1" it returns a column named "2" instead of "1 + 1"
204+
boolean skipColumnNameCheck = databaseName.equalsIgnoreCase("h2") || other.databaseName.equalsIgnoreCase("h2");
205+
if (!skipColumnNameCheck && !schema.equals(other.schema)) {
206+
return false;
207+
}
208+
if (skipColumnNameCheck && !schema.stream().map(Type::getType).collect(Collectors.toList())
209+
.equals(other.schema.stream().map(Type::getType).collect(Collectors.toList()))) {
210+
return false;
211+
}
212+
return dataRows.equals(other.dataRows);
213+
}
194214
}

0 commit comments

Comments
 (0)