diff options
author | Tom Sepez <tsepez@chromium.org> | 2024-04-11 20:54:04 +0000 |
---|---|---|
committer | Pdfium LUCI CQ <pdfium-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-04-11 20:54:04 +0000 |
commit | 3f197528d4753af1827a78760853cf72dbc6a001 (patch) | |
tree | 7f960ecefea2f4c14ed34c2261f04648bd3ed60c /core/fxcrt/widestring.cpp | |
parent | f0dc864fb19ec85c9496387f1e806b14f5e6d999 (diff) | |
download | pdfium-3f197528d4753af1827a78760853cf72dbc6a001.tar.gz |
Apply UNSAFE_BUFFERS() to two-arg span ctor in core/
Follow-on from
https://pdfium-review.googlesource.com/c/pdfium/+/118250
-- stop short of enforcement (will happen in a future CL)
Change-Id: Ie474b70644f417f0f0ed417adb03f5aba313de91
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118251
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring.cpp')
-rw-r--r-- | core/fxcrt/widestring.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/fxcrt/widestring.cpp b/core/fxcrt/widestring.cpp index 84676d5dd..02b78b7ac 100644 --- a/core/fxcrt/widestring.cpp +++ b/core/fxcrt/widestring.cpp @@ -14,6 +14,7 @@ #include "core/fxcrt/check.h" #include "core/fxcrt/check_op.h" +#include "core/fxcrt/compiler_specific.h" #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_extension.h" #include "core/fxcrt/fx_memcpy_wrappers.h" @@ -391,9 +392,11 @@ WideString WideString::Format(const wchar_t* pFormat, ...) { return ret; } +// TODO(tsepez): should be UNSAFE_BUFFER_USAGE. WideString::WideString(const wchar_t* pStr, size_t nLen) { if (nLen) { - m_pData = StringData::Create({pStr, nLen}); + // SAFETY: caller ensures `pStr` points to al least `nLen` wchar_t. + m_pData = StringData::Create(UNSAFE_BUFFERS(pdfium::make_span(pStr, nLen))); } } |