From 76188c505dac5c4e35911edbc97d0dacbe366038 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 4 Sep 2018 19:59:03 +0000 Subject: Fix some more span/memcpy interactions. Use the preferred idiom of creating a subspan, which makes the proper checks prior to the copy. Change-Id: Ia7f25b5760dea5707df66cf421195b23a1ce0ad0 Reviewed-on: https://pdfium-review.googlesource.com/41911 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fxcodec/codec/fx_codec.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/fxcodec') diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index efae53908e..b93f5418f3 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -1642,7 +1642,8 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { copy_len = m_SrcBuf.size() - m_SrcOffset; m_bEOD = true; } - memcpy(m_pScanline.get() + col_pos, &m_SrcBuf[m_SrcOffset], copy_len); + auto copy_span = m_SrcBuf.subspan(m_SrcOffset, copy_len); + memcpy(m_pScanline.get() + col_pos, copy_span.data(), copy_span.size()); col_pos += copy_len; UpdateOperator((uint8_t)copy_len); } else if (m_Operator > 128) { -- cgit v1.2.3