Skip to content

Commit

Permalink
Fix bug in 'list IN list' query
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo committed Apr 26, 2023
1 parent 76223b3 commit 7582518
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* None.
* Performing a query like "{1, 2, 3, ...} IN list" where the array is longer than 8 and all elements are smaller than some values in list, the program would crash ([#1183](https://github.com/realm/realm-kotlin/issues/1183), v12.5.0)

### Breaking changes
* None.
Expand Down
2 changes: 1 addition & 1 deletion src/realm/query_expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ class ValueBase {
}
else {
if (left[left_idx] < right[right_idx]) {
if (any && left_idx < left_size) {
if (any && left_idx < left_size - 1) {
left_idx++;
}
else {
Expand Down
1 change: 1 addition & 0 deletions test/test_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4035,6 +4035,7 @@ TEST(Parser_OperatorIN)
verify_query(test_context, t, "ALL {8, 10} / 2 >= ANY items.price", 1);
verify_query(test_context, t, "NONE {1, 2, 3} * 20 <= ANY items.price", 3);
verify_query(test_context, t, "ANY {1, 2, 3, 4, 5, 6} + 2 == ANY items.price", 1);
verify_query(test_context, t, "ANY {0, 1, 2, 3, 5, 6, 7, 8, 9} == ANY items.price", 0); // No hit and all smaller

// list property vs list property
verify_query(test_context, t, "items.price IN items.price", 3);
Expand Down

0 comments on commit 7582518

Please sign in to comment.