|
|
@ -138,19 +138,21 @@ class PROTOBUF_EXPORT EpsCopyInputStream { |
|
|
|
// - Every non-empty token is moved from and consumed.
|
|
|
|
// - Every non-empty token is moved from and consumed.
|
|
|
|
class LimitToken { |
|
|
|
class LimitToken { |
|
|
|
public: |
|
|
|
public: |
|
|
|
LimitToken() { PROTOBUF_POISON_MEMORY_REGION(this, sizeof(LimitToken)); } |
|
|
|
LimitToken() { PROTOBUF_POISON_MEMORY_REGION(&token_, sizeof(token_)); } |
|
|
|
explicit LimitToken(int token) : token_(token) { PROTOBUF_UNPOISON_MEMORY_REGION(this, sizeof(LimitToken)); } |
|
|
|
explicit LimitToken(int token) : token_(token) { |
|
|
|
|
|
|
|
PROTOBUF_UNPOISON_MEMORY_REGION(&token_, sizeof(token_)); |
|
|
|
|
|
|
|
} |
|
|
|
LimitToken(LimitToken&& other) { *this = std::move(other); } |
|
|
|
LimitToken(LimitToken&& other) { *this = std::move(other); } |
|
|
|
LimitToken& operator=(LimitToken&& other) { |
|
|
|
LimitToken& operator=(LimitToken&& other) { |
|
|
|
PROTOBUF_UNPOISON_MEMORY_REGION(this, sizeof(LimitToken)); |
|
|
|
PROTOBUF_UNPOISON_MEMORY_REGION(&token_, sizeof(token_)); |
|
|
|
token_ = other.token_; |
|
|
|
token_ = other.token_; |
|
|
|
PROTOBUF_POISON_MEMORY_REGION(&other, sizeof(LimitToken)); |
|
|
|
PROTOBUF_POISON_MEMORY_REGION(&other.token_, sizeof(token_)); |
|
|
|
return *this; |
|
|
|
return *this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
~LimitToken() { |
|
|
|
~LimitToken() { |
|
|
|
#ifdef ADDRESS_SANITIZER |
|
|
|
#ifdef ADDRESS_SANITIZER |
|
|
|
ABSL_CHECK(__asan_address_is_poisoned(this)); |
|
|
|
ABSL_CHECK(__asan_address_is_poisoned(&token_)); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -158,13 +160,9 @@ class PROTOBUF_EXPORT EpsCopyInputStream { |
|
|
|
LimitToken& operator=(const LimitToken&) = delete; |
|
|
|
LimitToken& operator=(const LimitToken&) = delete; |
|
|
|
|
|
|
|
|
|
|
|
int token() && { |
|
|
|
int token() && { |
|
|
|
#ifdef ADDRESS_SANITIZER |
|
|
|
|
|
|
|
int t = token_; |
|
|
|
int t = token_; |
|
|
|
PROTOBUF_POISON_MEMORY_REGION(this, sizeof(LimitToken)); |
|
|
|
PROTOBUF_POISON_MEMORY_REGION(&token_, sizeof(token_)); |
|
|
|
return t; |
|
|
|
return t; |
|
|
|
#else |
|
|
|
|
|
|
|
return token_; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|