Update buffer safety comments in fx_extension.cpp. Header is already specifying UNSAFE_BUFFER_USAGE for these two functions. Bug: 42271176 Change-Id: Icae84af6b28a7e26db55048e72d1c4e0d60c83a0 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/120591 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Thomas Sepez <tsepez@google.com> Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index f4fa200..67a5660 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp
@@ -30,7 +30,8 @@ } // namespace float FXSYS_wcstof(const wchar_t* pwsStr, size_t nLength, size_t* pUsedLen) { - auto copied = UNSAFE_TODO(WideString::Create(pwsStr, nLength)); + // SAFETY: required from caller, enforced by UNSAFE_BUFFER_USAGE in header. + auto copied = UNSAFE_BUFFERS(WideString::Create(pwsStr, nLength)); wchar_t* endptr = nullptr; float result = wcstof(copied.c_str(), &endptr); if (result != result) { @@ -42,13 +43,12 @@ return result; } -// TODO(tsepez): should be UNSAFE_BUFFER_USAGE. wchar_t* FXSYS_wcsncpy(wchar_t* dstStr, const wchar_t* srcStr, size_t count) { DCHECK(dstStr); DCHECK(srcStr); DCHECK(count > 0); - // SAFETY: required from caller. + // SAFETY: required from caller, enforced by UNSAFE_BUFFER_USAGE in header. UNSAFE_BUFFERS({ for (size_t i = 0; i < count; ++i) { dstStr[i] = srcStr[i];