diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-01-30 19:12:10 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-30 19:12:10 +0000 |
commit | aa1c7873c39964d063c89c14815e3fc566bbd896 (patch) | |
tree | 257726f71b9318d51587a9ed0d414e7acbdb0b46 /core/fxge/win32/fx_win32_gdipext.cpp | |
parent | 8cdea72a82aae5e07aa92e9886dbbe635eb8b7cc (diff) | |
download | pdfium-aa1c7873c39964d063c89c14815e3fc566bbd896.tar.xz |
Guard usages of tellp(). It may return -1 in error cases.
Change-Id: I064ddcad8671b9ade2c02142a6c2c2983846e3a9
Reviewed-on: https://pdfium-review.googlesource.com/24650
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/win32/fx_win32_gdipext.cpp')
-rw-r--r-- | core/fxge/win32/fx_win32_gdipext.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 64c8ea7408..a83a4496fe 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -952,6 +952,8 @@ class GpStream final : public IStream { start = m_ReadPos; break; case STREAM_SEEK_END: + if (m_InterStream.tellp() < 0) + return STG_E_SEEKERROR; start = m_InterStream.tellp(); break; default: @@ -973,6 +975,10 @@ class GpStream final : public IStream { return STG_E_INVALIDFUNCTION; ZeroMemory(pStatstg, sizeof(STATSTG)); + + if (m_InterStream.tellp() < 0) + return STG_E_SEEKERROR; + pStatstg->cbSize.QuadPart = m_InterStream.tellp(); return S_OK; } |