summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-09 18:30:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-09 18:30:24 +0000
commit53894390dba2ec571bab75157ebe60d11171ed07 (patch)
treea2187a69fdc5167be060c621370a6c7c84ebf2e3 /core/fxcrt
parentd45f9980995af5c6e4c68e32df89d3cccb0231ef (diff)
downloadpdfium-53894390dba2ec571bab75157ebe60d11171ed07.tar.xz
Use pdfium::span<> in CFX_BitStream, CPDF_SimpleParser.
Get bounds checks in parsers automatically when using spans. Change-Id: I71fbe7b838435d455376db2f89817d807a9cdcfd Reviewed-on: https://pdfium-review.googlesource.com/29830 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/cfx_bitstream.cpp6
-rw-r--r--core/fxcrt/cfx_bitstream.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/core/fxcrt/cfx_bitstream.cpp b/core/fxcrt/cfx_bitstream.cpp
index 7cf6d36adf..114b5a9d2a 100644
--- a/core/fxcrt/cfx_bitstream.cpp
+++ b/core/fxcrt/cfx_bitstream.cpp
@@ -10,9 +10,9 @@
#include "core/fxcrt/fx_system.h"
-CFX_BitStream::CFX_BitStream(const uint8_t* pData, uint32_t dwSize)
- : m_BitPos(0), m_BitSize(dwSize * 8), m_pData(pData) {
- ASSERT(dwSize <= std::numeric_limits<uint32_t>::max() / 8);
+CFX_BitStream::CFX_BitStream(pdfium::span<const uint8_t> pData)
+ : m_BitPos(0), m_BitSize(pData.size() * 8), m_pData(pData.data()) {
+ ASSERT(pData.size() <= std::numeric_limits<uint32_t>::max() / 8);
}
CFX_BitStream::~CFX_BitStream() {}
diff --git a/core/fxcrt/cfx_bitstream.h b/core/fxcrt/cfx_bitstream.h
index 168760ddd8..baa2a9f544 100644
--- a/core/fxcrt/cfx_bitstream.h
+++ b/core/fxcrt/cfx_bitstream.h
@@ -10,10 +10,11 @@
#include <stdint.h>
#include "core/fxcrt/unowned_ptr.h"
+#include "third_party/base/span.h"
class CFX_BitStream {
public:
- CFX_BitStream(const uint8_t* pData, uint32_t dwSize);
+ explicit CFX_BitStream(pdfium::span<const uint8_t> pData);
~CFX_BitStream();
void ByteAlign();