Remove ProbeForLowSeverityLifetimeIssue() from UnownedPtr.
This functionality is now wholly performed on the PA side by its
various raw_ptr<> implementations.
Bug: pdfium:2038
Change-Id: I58007a5fe135e23e0d1346a2265dbef66ee2ebd0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/112412
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/unowned_ptr.h b/core/fxcrt/unowned_ptr.h
index ab92bc6..039ec7e 100644
--- a/core/fxcrt/unowned_ptr.h
+++ b/core/fxcrt/unowned_ptr.h
@@ -68,13 +68,6 @@
#include "core/fxcrt/unowned_ptr_exclusion.h"
#include "third_party/base/compiler_specific.h"
-namespace pdfium {
-
-template <typename T>
-class span;
-
-} // namespace pdfium
-
namespace fxcrt {
template <class T>
@@ -161,7 +154,6 @@
}
~UnownedPtr() {
- ProbeForLowSeverityLifetimeIssue();
m_pObj = nullptr;
}
@@ -177,7 +169,6 @@
T* get() const noexcept { return m_pObj; }
T* ExtractAsDangling() {
- ProbeForLowSeverityLifetimeIssue();
T* pTemp = nullptr;
std::swap(pTemp, m_pObj);
return pTemp;
@@ -188,26 +179,10 @@
T* operator->() const { return m_pObj; }
private:
- friend class pdfium::span<T>;
-
void Reset(T* obj = nullptr) {
- ProbeForLowSeverityLifetimeIssue();
m_pObj = obj;
}
- inline void ProbeForLowSeverityLifetimeIssue() {
-#if defined(ADDRESS_SANITIZER)
- if (m_pObj)
- reinterpret_cast<const volatile uint8_t*>(m_pObj)[0];
-#endif
- }
-
- inline void ReleaseBadPointer() {
-#if defined(ADDRESS_SANITIZER)
- m_pObj = nullptr;
-#endif
- }
-
UNOWNED_PTR_EXCLUSION T* m_pObj = nullptr;
};
diff --git a/third_party/base/containers/span.h b/third_party/base/containers/span.h
index 660d92c..435fafa 100644
--- a/third_party/base/containers/span.h
+++ b/third_party/base/containers/span.h
@@ -228,13 +228,12 @@
constexpr span(const span<U>& other) : span(other.data(), other.size()) {}
span& operator=(const span& other) noexcept {
if (this != &other) {
- ReleaseEmptySpan();
data_ = other.data_;
size_ = other.size_;
}
return *this;
}
- ~span() noexcept { ReleaseEmptySpan(); }
+ ~span() noexcept = default;
// [span.sub], span subviews
const span first(size_t count) const {
@@ -299,15 +298,6 @@
}
private:
- void ReleaseEmptySpan() noexcept {
-#if defined(ADDRESS_SANITIZER) && !defined(UNOWNED_PTR_IS_BASE_RAW_PTR)
- // Empty spans might point to byte N+1 of a N-byte object, legal for
- // C pointers but not UnownedPtrs.
- if (!size_)
- data_.ReleaseBadPointer();
-#endif
- }
-
#if defined(UNOWNED_PTR_IS_BASE_RAW_PTR)
raw_ptr<T, AllowPtrArithmetic> data_ = nullptr;
#else