diff options
author | Martijn Vels <mvels@google.com> | 2022-12-07 07:14:42 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-12-07 07:15:19 -0800 |
commit | 5736d76ae60c1746cf6fe60466df655c91bf7a7b (patch) | |
tree | f2a307cbb31cc2de71ba424784626d3b3a2568f8 /absl/strings/internal/ostringstream.h | |
parent | c96db73c09dbb528eca6d19a50bd258b37e9fd5e (diff) |
Remove possible UB from CopyRaw()
This change removes the 'create by single memcpy' CopyRaw() logic to avoid potential UB from the atomic refcount data being included in the memcpy. While we know this works on all supported platforms, it is officially UB, and we should change it to something else. This change changes the CopyRaw() method to explicitly create a (default initialized) instance, initialize `length` and `refcount`, and then memcpy the remaining contents which are trivial uint8_t and CordRep* values.
PiperOrigin-RevId: 493596072
Change-Id: I46618883eb1c7c9ed9eb083f4d3e7fc501f23df5
Diffstat (limited to 'absl/strings/internal/ostringstream.h')
0 files changed, 0 insertions, 0 deletions