From: Louis Brandy Date: Thu, 7 Dec 2017 01:10:31 +0000 (-0800) Subject: fix ubsan-detected UMR in TemporaryFile X-Git-Tag: v2017.12.11.00~20 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=989c511267f61b5b172c92f39a05f1bf35392ab5;p=folly.git fix ubsan-detected UMR in TemporaryFile Summary: Move constructors are just like any other constructors. `this` is not in a valid state. You aren't supposed to destroy `this` before move-constructing it. This was detected by ubsan stress runs. UBSAN report: ``` [ RUN ] TemporaryFile.moveCtor folly/experimental/TestUtil.cpp:91:20: runtime error: load of value 3, which is not a valid value for type 'bool' [ failed: 1 ] ```` Reviewed By: yfeldblum Differential Revision: D6501500 fbshipit-source-id: 83bd0525ac2c1f5951f70f5596034bb6cb0ca985 --- diff --git a/folly/experimental/TestUtil.h b/folly/experimental/TestUtil.h index 1b8e339d..dc75069a 100644 --- a/folly/experimental/TestUtil.h +++ b/folly/experimental/TestUtil.h @@ -52,7 +52,6 @@ class TemporaryFile { // Movable, but not copyable TemporaryFile(TemporaryFile&& other) noexcept { - reset(); assign(other); }