summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2014-08-07 10:08:19 -0700
committerJun Fang <jun_fang@foxitsoftware.com>2014-08-07 10:08:19 -0700
commitdf449c0eb4b1fb5583da71265faf50a9a520be3c (patch)
treeaf2cd605bebfe9d2b745fbc11585e5d73bce7ed3
parent2ee9c3a71497cb637a4953928014863a4ebb1ed6 (diff)
downloadpdfium-chromium/2119.tar.xz
Change '>=' back to '>' in extension.h due to bad fixchromium/2122chromium/2121chromium/2120chromium/2119chromium/2118
BUG=400662 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/445303002
-rw-r--r--core/src/fxcrt/extension.h8
-rw-r--r--fpdfsdk/src/fpdfview.cpp18
2 files changed, 14 insertions, 12 deletions
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index 6221d14fc7..bb2a79b9f9 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -73,7 +73,7 @@ public:
FX_SAFE_FILESIZE pos = size;
pos += offset;
- if (!pos.IsValid() || pos.ValueOrDie() >= m_pFile->GetSize()) {
+ if (!pos.IsValid() || pos.ValueOrDie() > m_pFile->GetSize()) {
return FALSE;
}
@@ -95,7 +95,7 @@ public:
if (m_bUseRange) {
pos += m_nOffset;
- if (!pos.IsValid() || pos.ValueOrDie() >= (size_t)GetSize()) {
+ if (!pos.IsValid() || pos.ValueOrDie() > (size_t)GetSize()) {
return FALSE;
}
}
@@ -200,7 +200,7 @@ public:
}
FX_SAFE_FILESIZE range = size;
range += offset;
- if (!range.IsValid() || range.ValueOrDie() >= m_nCurSize) {
+ if (!range.IsValid() || range.ValueOrDie() > m_nCurSize) {
return FALSE;
}
@@ -232,7 +232,7 @@ public:
FX_SAFE_SIZE_T newPos = size;
newPos += offset;
- if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 || newPos.ValueOrDie() >= m_nCurSize) {
+ if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 || newPos.ValueOrDie() > m_nCurSize) {
return FALSE;
}
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index af24e71b94..23d44935b5 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -299,14 +299,16 @@ public:
virtual FX_FILESIZE GetSize() {return m_size;}
virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size)
{
- if (offset < 0) {
- return FALSE;
- }
- FX_SAFE_FILESIZE newPos = base::checked_cast<FX_FILESIZE, size_t>(size);
- newPos += offset;
- if (!newPos.IsValid() || newPos.ValueOrDie() > (FX_DWORD)m_size) return FALSE;
- FXSYS_memcpy(buffer, m_pBuf+offset, size);
- return TRUE;
+ if (offset < 0) {
+ return FALSE;
+ }
+ FX_SAFE_FILESIZE newPos = base::checked_cast<FX_FILESIZE, size_t>(size);
+ newPos += offset;
+ if (!newPos.IsValid() || newPos.ValueOrDie() > (FX_DWORD)m_size) {
+ return FALSE;
+ }
+ FXSYS_memcpy(buffer, m_pBuf+offset, size);
+ return TRUE;
}
private:
FX_BYTE* m_pBuf;