Skip to content

Commit

Permalink
Fix use-after-free bug in UnsafeExternalRowSorter.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshRosen committed Jul 27, 2015
1 parent 8abcf82 commit f4cf91d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ public InternalRow next() {
numFields,
sortedIterator.getRecordLength());
if (!hasNext()) {
row.copy(); // so that we don't have dangling pointers to freed page
UnsafeRow copy = row.copy(); // so that we don't have dangling pointers to freed page
row.pointTo(null, 0, 0, 0); // so that we don't keep references to the base object
cleanupResources();
return copy;
} else {
return row;
}
return row;
} catch (IOException e) {
cleanupResources();
// Scala iterators don't declare any checked exceptions, so we need to use this hack
Expand Down

0 comments on commit f4cf91d

Please sign in to comment.