You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2020/06/22 22:10:38 UTC

[impala] branch master updated: IMPALA-9878: Fix use-after-free in TmpFileMgrTest's TestAllocation

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b1cfac  IMPALA-9878: Fix use-after-free in TmpFileMgrTest's TestAllocation
7b1cfac is described below

commit 7b1cfacbc6c4c709947cb91517baa9ec364afee1
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Mon Jun 22 09:36:33 2020 -0700

    IMPALA-9878: Fix use-after-free in TmpFileMgrTest's TestAllocation
    
    ASAN found a use-after-free for the in this code:
      file_group.Close(); <--- free underlying storage for 'file'
      EXPECT_FALSE(boost::filesystem::exists(file->path())); <-- use 'file'
    This switches it to a copy of file->path().
    
    Testing:
     - Ran tmp-file-mgr-test under ASAN
    
    Change-Id: Idd5cbae70c287c78db8d1c560d8c777d6bed5b56
    Reviewed-on: http://gerrit.cloudera.org:8080/16099
    Reviewed-by: Tim Armstrong <ta...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/runtime/tmp-file-mgr-test.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/be/src/runtime/tmp-file-mgr-test.cc b/be/src/runtime/tmp-file-mgr-test.cc
index 57a409b..fcf581c 100644
--- a/be/src/runtime/tmp-file-mgr-test.cc
+++ b/be/src/runtime/tmp-file-mgr-test.cc
@@ -278,7 +278,7 @@ TEST_F(TmpFileMgrTest, TestFileAllocation) {
   // tmp file is only allocated on writes.
   EXPECT_OK(FileSystemUtil::CreateFile(file->path()));
   file_group.Close();
-  EXPECT_FALSE(boost::filesystem::exists(file->path()));
+  EXPECT_FALSE(boost::filesystem::exists(file_path));
   CheckMetrics(&tmp_file_mgr);
 }