]> Cypherpunks repositories - gostls13.git/commit
os: fix aliasing bug in RemoveAllTestHook restoration
authorBryan C. Mills <bcmills@google.com>
Thu, 11 Apr 2019 19:42:21 +0000 (15:42 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 11 Apr 2019 20:03:44 +0000 (20:03 +0000)
commit2ebdb5ec0652742afe7f0c58f708ca5128ef5d5e
tree9a24e511d27b93703be533c2cfa3a66ce3d3373c
parent8d86ef221631757ef4d89401947db674c730f94e
os: fix aliasing bug in RemoveAllTestHook restoration

The code to swap RemoveAllTestHook in and out in
TestRemoveAllWithMoreErrorThanReqSize was making a copy of the
RemoveAllTestHook pointer, then attempting to restore by loading from
the copy of that pointer. Since the two copies of the pointer aliased
the same address, the restore operation had no effect, and any
RemoveAll tests that happened to run after
TestRemoveAllWithMoreErrorThanReqSize would fail.

Fixes #31421

Change-Id: I7028475f5ceb3b0a2fa69d22af8d3379508c4531
Reviewed-on: https://go-review.googlesource.com/c/go/+/171777
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/os/removeall_test.go