commit | dd1039061296b3de5ffd283529046d544175d1aa | [log] [tgz] |
---|---|---|
author | Tom Sepez <tsepez@chromium.org> | Wed Apr 03 16:03:45 2019 +0000 |
committer | Chromium commit bot <commit-bot@chromium.org> | Wed Apr 03 16:03:45 2019 +0000 |
tree | 8a31d14a5a13fd3671b9b12a983bd57227a5592b | |
parent | 682e2aaf1c4b6cfb088f2d7228e2f144246edf70 [diff] |
Use span arithmetic in cfx_seekablemultistream Gets some bounds checks under the covers. Change-Id: I86ffe443f29a24e84aa04e26fb2d730bbaf37589 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52791 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/cfx_seekablemultistream.cpp b/core/fxcrt/cfx_seekablemultistream.cpp index d817000..f600854 100644 --- a/core/fxcrt/cfx_seekablemultistream.cpp +++ b/core/fxcrt/cfx_seekablemultistream.cpp
@@ -47,7 +47,7 @@ const auto& acc = m_Data[index]; uint32_t dwSize = acc->GetSize(); size_t dwRead = std::min(size, static_cast<size_t>(dwSize - offset)); - memcpy(buffer, acc->GetData() + offset, dwRead); + memcpy(buffer, acc->GetSpan().subspan(offset, dwRead).data(), dwRead); size -= dwRead; if (size == 0) return true;