diff options
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_array.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 15 |
3 files changed, 9 insertions, 12 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp index 69de5bbc26..544469916b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp @@ -47,7 +47,7 @@ const CPDF_Array* CPDF_Array::AsArray() const { CPDF_Object* CPDF_Array::Clone(FX_BOOL bDirect) const { CPDF_Array* pCopy = new CPDF_Array(); - for (int i = 0; i < GetCount(); i++) { + for (size_t i = 0; i < GetCount(); i++) { CPDF_Object* value = m_Objects.GetAt(i); pCopy->m_Objects.Add(value->Clone(bDirect)); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp index dd2be01311..147ae37ed0 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp @@ -185,7 +185,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { if (!CanReadFromBitStream(hStream, required_bits)) return FALSE; - for (int j = 0; j < m_dwNSharedObjsArray[i]; j++) + for (uint32_t j = 0; j < m_dwNSharedObjsArray[i]; j++) m_dwIdentifierArray.Add(hStream->GetBits(dwSharedIdBits)); } hStream->ByteAlign(); @@ -385,7 +385,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage( uint32_t dwIndex = 0; uint32_t dwObjNum = 0; - for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) { + for (uint32_t j = 0; j < m_dwNSharedObjsArray[index]; ++j) { dwIndex = m_dwIdentifierArray[offset + j]; if (dwIndex >= m_dwSharedObjNumArray.GetSize()) return IPDF_DataAvail::DataNotAvailable; diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index 219a72507b..346476b62b 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -176,24 +176,21 @@ uint32_t RunLengthDecode(const uint8_t* src_buf, if (src_buf[i] < 128) { old = dest_size; dest_size += src_buf[i] + 1; - if (dest_size < old) { - return static_cast<uint32_t>(-1); - } + if (dest_size < old) + return FX_INVALID_OFFSET; i += src_buf[i] + 2; } else if (src_buf[i] > 128) { old = dest_size; dest_size += 257 - src_buf[i]; - if (dest_size < old) { - return static_cast<uint32_t>(-1); - } + if (dest_size < old) + return FX_INVALID_OFFSET; i += 2; } else { break; } } - if (dest_size >= _STREAM_MAX_SIZE_) { - return static_cast<uint32_t>(-1); - } + if (dest_size >= _STREAM_MAX_SIZE_) + return FX_INVALID_OFFSET; dest_buf = FX_Alloc(uint8_t, dest_size); i = 0; int dest_count = 0; |