Internal Jenkins has submitted this change and it was merged. Change subject: IMPALA-3854: Fix use-after-free in HdfsTextScanner::Close() ......................................................................
IMPALA-3854: Fix use-after-free in HdfsTextScanner::Close() A recent commit changed the ownership of the Stream object to its owning ScannerContext. After that change, a Stream object will be destroyed in ScannerContext::ReleaseCompletedResources() if the parameter 'done' is true. That usually happens in the Close() function of a scanner. However, for the text scanner, the Stream object can be destroyed after handling compressed data before Close() is called. In that case, the cached handle to the Stream object is invalid when it's referenced in Close() to access the compression codec of the Stream object. This change fixes the above problem by not deleting the stream objects in ScannerContext::ReleaseCompletedResources(). Instead a new function ScannerContext::ClearStreams() is added for that purpose and it's invoked in HdfsScanner::Close() to release all the stream objects. This avoids other use-after-free problems in the code. Change-Id: Ia88f6285563ff669ae215af22ed2d45e5398adae Reviewed-on: http://gerrit.cloudera.org:8080/3630 Reviewed-by: Michael Ho <[email protected]> Tested-by: Internal Jenkins --- M be/src/exec/hdfs-parquet-scanner.cc M be/src/exec/hdfs-scan-node.cc M be/src/exec/hdfs-scanner.cc M be/src/exec/hdfs-text-scanner.cc M be/src/exec/scanner-context.cc M be/src/exec/scanner-context.h 6 files changed, 29 insertions(+), 18 deletions(-) Approvals: Michael Ho: Looks good to me, approved Internal Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/3630 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia88f6285563ff669ae215af22ed2d45e5398adae Gerrit-PatchSet: 6 Gerrit-Project: Impala Gerrit-Branch: cdh5-trunk Gerrit-Owner: Michael Ho <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Internal Jenkins Gerrit-Reviewer: Michael Ho <[email protected]>
