summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_image.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-21 15:34:45 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-21 15:34:45 +0000
commit8590a98297c5a56e63efc63931c1b3998160e049 (patch)
tree351a3765f746d10a0eb2c6f880864b1603a01e97 /core/fpdfapi/page/cpdf_image.cpp
parent9d784c291714b703b16185e69860a3797de85b6c (diff)
downloadpdfium-8590a98297c5a56e63efc63931c1b3998160e049.tar.xz
Validate more image values in CPDF_DIBBase.
Change-Id: Ia5f72e6397ee959d897a945c4069f47c494b5511 Reviewed-on: https://pdfium-review.googlesource.com/42870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_image.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index 85e7d8a038..f7eec131ad 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -32,18 +32,16 @@
#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/ptr_util.h"
-namespace {
-
-bool IsValidJpegComponent(int32_t comps) {
+// static
+bool CPDF_Image::IsValidJpegComponent(int32_t comps) {
return comps == 1 || comps == 3 || comps == 4;
}
-bool IsValidJpegBitsPerComponent(int32_t bpc) {
+// static
+bool CPDF_Image::IsValidJpegBitsPerComponent(int32_t bpc) {
return bpc == 1 || bpc == 2 || bpc == 4 || bpc == 8 || bpc == 16;
}
-} // namespace
-
CPDF_Image::CPDF_Image(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
CPDF_Image::CPDF_Image(CPDF_Document* pDoc,