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

Unified Diff: core/fpdfapi/page/fpdf_page_func.cpp

Issue 2414473003: Handle undefined shifts in CPDF_PSEngine. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/page/fpdf_page_func.cpp
diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp
index d2e08a511c6566e583e9f7e29c0221058580ed1c..248a13ab84038a712a171d05e9ac07c8b70a6b70 100644
--- a/core/fpdfapi/page/fpdf_page_func.cpp
+++ b/core/fpdfapi/page/fpdf_page_func.cpp
@@ -343,11 +343,12 @@ FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) {
case PSOP_BITSHIFT: {
int shift = (int)Pop();
int i = (int)Pop();
- if (shift > 0) {
+ if (shift < -31 || shift > 31)
Tom Sepez 2016/10/12 20:17:58 http://en.cppreference.com/w/cpp/language/operator
+ Push(0);
+ else if (shift >= 0)
Push(i << shift);
- } else {
+ else
Push(i >> -shift);
- }
break;
}
case PSOP_TRUE:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698