Apply UNSAFE_BUFFERS() to two-arg span ctor in xfa/
Follow-on from
https://pdfium-review.googlesource.com/c/pdfium/+/118250
-- also include fxbarcode directory, since it is only used for xfa.
Change-Id: I5548bd7cffaaee12c7e30091c7bf4d58b450c535
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/118271
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxbarcode/oned/BC_OnedCode128Writer.cpp b/fxbarcode/oned/BC_OnedCode128Writer.cpp
index 4a0c8f8..2f0c259 100644
--- a/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -142,8 +142,8 @@
DataVector<uint8_t> result(codeWidth);
auto result_span = pdfium::make_span(result);
for (const int32_t pattern_index : patterns) {
- const uint8_t* pattern = kCodePatterns[pattern_index];
- result_span = AppendPattern(result_span, {pattern, kPatternSize}, true);
+ result_span =
+ AppendPattern(result_span, kCodePatterns[pattern_index], true);
}
return result;
}
diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp
index 70e629c..800cdea 100644
--- a/xfa/fde/cfde_textout.cpp
+++ b/xfa/fde/cfde_textout.cpp
@@ -303,12 +303,12 @@
for (size_t i = 0; i < line.GetSize(); ++i) {
const Piece* pPiece = line.GetPieceAtIndex(i);
size_t szCount = GetDisplayPos(pPiece);
- if (szCount == 0)
+ if (szCount == 0) {
continue;
-
+ }
CFDE_TextOut::DrawString(device, m_TxtColor, m_pFont,
- {m_CharPos.data(), szCount}, m_fFontSize,
- m_Matrix);
+ pdfium::make_span(m_CharPos).first(szCount),
+ m_fFontSize, m_Matrix);
}
}
device->RestoreState(false);
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 28d46fc..15a40cb 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -17,6 +17,7 @@
#include "core/fxcrt/byteorder.h"
#include "core/fxcrt/cfx_read_only_vector_stream.h"
#include "core/fxcrt/check.h"
+#include "core/fxcrt/compiler_specific.h"
#include "core/fxcrt/containers/contains.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fixed_size_data_vector.h"
@@ -395,9 +396,12 @@
IFX_SeekableReadStream* pFile =
static_cast<IFX_SeekableReadStream*>(stream->descriptor.pointer);
- if (!pFile->ReadBlockAtOffset({buffer, count}, offset))
- return 0;
+ // SAFETY: required from caller.
+ if (!pFile->ReadBlockAtOffset(
+ UNSAFE_BUFFERS(pdfium::make_span(buffer, count), offset))) {
+ return 0;
+ }
return count;
}