diff options
author | tsepez <tsepez@chromium.org> | 2016-08-02 13:36:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-02 13:36:16 -0700 |
commit | e21501d9427539828b5d547b9d20a752d06914aa (patch) | |
tree | 78cc1bfe0ea26fd2a55ef7576e0cbd170dcbc396 /core/fxcodec/jbig2/JBig2_Context.cpp | |
parent | 0a7552ffa04bfb0c0523bd9c88e55e82842f53a8 (diff) | |
download | pdfium-e21501d9427539828b5d547b9d20a752d06914aa.tar.xz |
Bound total pixels in JBig2 images to avoid overflows later.
Also make these private to ensure they aren't modified so as to
violate the bounds checks applied at creation time.
BUG=633002
Review-Url: https://codereview.chromium.org/2202013002
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Context.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 256ce3910a..911eb0bf63 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -924,7 +924,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { if (!m_bBufSpecified) { JBig2PageInfo* pPageInfo = m_PageInfoList.back(); if ((pPageInfo->m_bIsStriped == 1) && - (ri.y + ri.height > m_pPage->m_nHeight)) { + (ri.y + ri.height > m_pPage->height())) { m_pPage->expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } @@ -1015,8 +1015,8 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, pHRD->HNUMPATS = pPatternDict->NUMPATS; pHRD->HPATS = pPatternDict->HDPATS; - pHRD->HPW = pPatternDict->HDPATS[0]->m_nWidth; - pHRD->HPH = pPatternDict->HDPATS[0]->m_nHeight; + pHRD->HPW = pPatternDict->HDPATS[0]->width(); + pHRD->HPH = pPatternDict->HDPATS[0]->height(); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; if (pHRD->HMMR == 0) { const size_t size = GetHuffContextSize(pHRD->HTEMPLATE); @@ -1042,7 +1042,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, if (!m_bBufSpecified) { JBig2PageInfo* pPageInfo = m_PageInfoList.back(); if (pPageInfo->m_bIsStriped == 1 && - ri.y + ri.height > m_pPage->m_nHeight) { + ri.y + ri.height > m_pPage->height()) { m_pPage->expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } @@ -1108,7 +1108,7 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, if (!m_bBufSpecified) { JBig2PageInfo* pPageInfo = m_PageInfoList.back(); if ((pPageInfo->m_bIsStriped == 1) && - (m_ri.y + m_ri.height > m_pPage->m_nHeight)) { + (m_ri.y + m_ri.height > m_pPage->height())) { m_pPage->expand(m_ri.y + m_ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } @@ -1142,7 +1142,7 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, if (!m_bBufSpecified) { JBig2PageInfo* pPageInfo = m_PageInfoList.back(); if ((pPageInfo->m_bIsStriped == 1) && - (m_ri.y + m_ri.height > m_pPage->m_nHeight)) { + (m_ri.y + m_ri.height > m_pPage->height())) { m_pPage->expand(m_ri.y + m_ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } @@ -1215,7 +1215,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { if (!m_bBufSpecified) { JBig2PageInfo* pPageInfo = m_PageInfoList.back(); if ((pPageInfo->m_bIsStriped == 1) && - (ri.y + ri.height > m_pPage->m_nHeight)) { + (ri.y + ri.height > m_pPage->height())) { m_pPage->expand(ri.y + ri.height, (pPageInfo->m_cFlags & 4) ? 1 : 0); } } |