Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2901)

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp

Issue 2194853002: Cleanup CPDF_DocPageData release methods and callers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/fpdfapi/fpdf_page/pageint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 42adb846383f3bb8942c67486d8f287db28ed5cd..2639d7aa5cfc5475e6a2206f62b51081205f9ab7 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -160,36 +160,36 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
uint32_t bpc = pDict->GetIntegerBy("BitsPerComponent");
uint32_t nComponents = 1;
CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj);
- if (!pCS) {
- nComponents = 3;
- } else {
+ if (pCS) {
nComponents = pCS->CountComponents();
pDoc->GetPageData()->ReleaseColorSpace(pCSObj);
+ } else {
+ nComponents = 3;
}
uint32_t pitch = width;
- if (bpc && pitch > INT_MAX / bpc) {
+ if (bpc && pitch > INT_MAX / bpc)
return nullptr;
- }
+
pitch *= bpc;
- if (nComponents && pitch > INT_MAX / nComponents) {
+ if (nComponents && pitch > INT_MAX / nComponents)
return nullptr;
- }
+
pitch *= nComponents;
- if (pitch > INT_MAX - 7) {
+ if (pitch > INT_MAX - 7)
return nullptr;
- }
+
pitch += 7;
pitch /= 8;
OrigSize = pitch;
} else {
- if (width > INT_MAX - 7) {
+ if (width > INT_MAX - 7)
return nullptr;
- }
+
OrigSize = ((width + 7) / 8);
}
- if (height && OrigSize > INT_MAX / height) {
+ if (height && OrigSize > INT_MAX / height)
return nullptr;
- }
+
OrigSize *= height;
uint8_t* pData = nullptr;
uint32_t dwStreamSize;
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/fpdfapi/fpdf_page/pageint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698