summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_Image.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-27 16:54:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 16:54:28 +0000
commit61f66c9be2abf4f2a5f8bc299ad6e1900c63dbc3 (patch)
tree4dc0116df63dce8414b8c08c272e5d0878ed8f03 /core/fxcodec/jbig2/JBig2_Image.cpp
parent0e3635c59e79e8ca782412fa1bcf377c7c4f980e (diff)
downloadpdfium-61f66c9be2abf4f2a5f8bc299ad6e1900c63dbc3.tar.xz
Add CJBig2_Image::IsValidImageSize() helper method.
Change-Id: Ic2acd6f03b9b2e52b3d94d7579d5dc36c8e62c96 Reviewed-on: https://pdfium-review.googlesource.com/31530 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Image.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_Image.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp
index d229e0ca01..7a01d01d64 100644
--- a/core/fxcodec/jbig2/JBig2_Image.cpp
+++ b/core/fxcodec/jbig2/JBig2_Image.cpp
@@ -68,6 +68,12 @@ CJBig2_Image::CJBig2_Image(const CJBig2_Image& other)
CJBig2_Image::~CJBig2_Image() {}
+// static
+bool CJBig2_Image::IsValidImageSize(int32_t w, int32_t h) {
+ return w > 0 && w <= JBIG2_MAX_IMAGE_SIZE && h > 0 &&
+ h <= JBIG2_MAX_IMAGE_SIZE;
+}
+
int CJBig2_Image::getPixel(int32_t x, int32_t y) const {
if (!m_pData)
return 0;