summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index e691f3ab10..f115b6770d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -449,8 +449,7 @@ public:
virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const;
SampleEncodeInfo* m_pEncodeInfo;
SampleDecodeInfo* m_pDecodeInfo;
- FX_DWORD m_nBitsPerSample;
- FX_DWORD m_SampleMax;
+ FX_DWORD m_nBitsPerSample, m_SampleMax;
CPDF_StreamAcc* m_pSampleStream;
};
CPDF_SampledFunc::CPDF_SampledFunc()
@@ -480,9 +479,6 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj)
CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode"));
CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample"));
- if (m_nBitsPerSample > 32) {
- return FALSE;
- }
m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample);
m_pSampleStream = new CPDF_StreamAcc;
m_pSampleStream->LoadAllData(pStream, FALSE);
@@ -557,23 +553,20 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const
}
pos += index[i] * blocksize[i];
}
- FX_SAFE_INT32 bits_to_output = m_nOutputs;
- bits_to_output *= m_nBitsPerSample;
- if (!bits_to_output.IsValid()) {
- return FALSE;
- }
FX_SAFE_INT32 bitpos = pos;
- bitpos *= bits_to_output.ValueOrDie();
+ bitpos *= m_nBitsPerSample;
+ bitpos *= m_nOutputs;
if (!bitpos.IsValid()) {
return FALSE;
}
- FX_SAFE_INT32 range_check = bitpos;
- range_check += bits_to_output.ValueOrDie();
- if (!range_check.IsValid()) {
+ const uint8_t* pSampleData = m_pSampleStream->GetData();
+ if (pSampleData == NULL) {
return FALSE;
}
- const uint8_t* pSampleData = m_pSampleStream->GetData();
- if (!pSampleData) {
+ FX_SAFE_INT32 bitpos1 = m_nOutputs - 1 > 0 ? m_nOutputs - 1 : 0;
+ bitpos1 *= m_nBitsPerSample;
+ bitpos1 += bitpos.ValueOrDie();
+ if (!bitpos1.IsValid()) {
return FALSE;
}
for (int j = 0; j < m_nOutputs; j ++) {