diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-09-04 19:59:03 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-09-04 19:59:03 +0000 |
commit | 76188c505dac5c4e35911edbc97d0dacbe366038 (patch) | |
tree | 91b8413cbf748a38b39f391472b77d201ecc8f39 /core/fxcrt | |
parent | 73e97f4fac2f4f591ff62e70377a80fd40b5f6f3 (diff) | |
download | pdfium-76188c505dac5c4e35911edbc97d0dacbe366038.tar.xz |
Fix some more span/memcpy interactions.
Use the preferred idiom of creating a subspan, which makes the
proper checks prior to the copy.
Change-Id: Ia7f25b5760dea5707df66cf421195b23a1ce0ad0
Reviewed-on: https://pdfium-review.googlesource.com/41911
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/cfx_readonlymemorystream.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/fxcrt/cfx_readonlymemorystream.cpp b/core/fxcrt/cfx_readonlymemorystream.cpp index 0a1a53a456..7b6a4c244d 100644 --- a/core/fxcrt/cfx_readonlymemorystream.cpp +++ b/core/fxcrt/cfx_readonlymemorystream.cpp @@ -29,6 +29,7 @@ bool CFX_ReadOnlyMemoryStream::ReadBlock(void* buffer, if (!pos.IsValid() || pos.ValueOrDie() > m_span.size()) return false; - memcpy(buffer, &m_span[offset], size); + auto copy_span = m_span.subspan(offset, size); + memcpy(buffer, copy_span.data(), copy_span.size()); return true; } |