Skip to content

Commit

Permalink
Fix an out-of-bounds read in the OPTIONAL JOIN implementation (#1710)
Browse files Browse the repository at this point in the history
  • Loading branch information
joka921 authored Jan 23, 2025
1 parent 2cf878c commit 6f6e0c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util/JoinAlgorithms/JoinAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ void specialOptionalJoin(
elFromFirstNotFoundAction(it);
}
it1 = next1;
if (it1 == end1) {
break;
}

checkCancellation();

Expand Down
12 changes: 12 additions & 0 deletions test/EngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ TEST(OptionalJoin, specialOptionalJoinTwoColumns) {
IdTable expectedResult = makeIdTableFromVector(
{{4, 1, 2, U}, {2, 1, 3, 3}, {1, 1, 4, U}, {2, 2, 2, 4}, {1, 3, 1, 1}});

testOptionalJoin(a, b, jcls, expectedResult);
}
{
// Test a corner case that previously contained a bug.
IdTable a{makeIdTableFromVector({{4, U, 2}})};
IdTable b{makeIdTableFromVector({{3, 3, 1}})};
// Join a and b on the column pairs 1,2 and 2,1 (entries from columns 1 of
// a have to equal those of column 2 of b and vice versa).
JoinColumns jcls{{1, 2}, {2, 1}};

IdTable expectedResult = makeIdTableFromVector({{4, U, 2, U}});

testOptionalJoin(a, b, jcls, expectedResult);
}
}
Expand Down

0 comments on commit 6f6e0c4

Please sign in to comment.