Chromium Code Reviews| 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..2efbdc24808f064928da8c7fca9e7606efa83505 100644 |
| --- a/core/fpdfapi/page/fpdf_page_func.cpp |
| +++ b/core/fpdfapi/page/fpdf_page_func.cpp |
| @@ -343,11 +343,20 @@ FX_BOOL CPDF_PSEngine::DoOperator(PDF_PSOP op) { |
| case PSOP_BITSHIFT: { |
| int shift = (int)Pop(); |
| int i = (int)Pop(); |
| - if (shift > 0) { |
| - Push(i << shift); |
| - } else { |
| - Push(i >> -shift); |
| + if (shift == 0) { |
| + Push(i); |
| + break; |
| + } |
| + if (shift < -31 || shift > 31) { |
| + Push(0); |
| + break; |
| } |
| + uint64_t unsigned_i = i; |
|
Tom Sepez
2016/10/20 20:55:29
think we want to do it as a signed64?
|
| + if (shift > 0) |
| + unsigned_i <<= shift; |
| + else |
| + unsigned_i >>= shift; |
|
Tom Sepez
2016/10/20 20:55:30
need a -shift here?
|
| + Push(static_cast<int>(unsigned_i & 0xFFFFFFFF)); |
| break; |
| } |
| case PSOP_TRUE: |