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

Side by Side Diff: core/fpdfapi/page/fpdf_page_func.cpp

Issue 2414473003: Handle undefined shifts in CPDF_PSEngine. (Closed)
Patch Set: self nit 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/page/pageint.h" 7 #include "core/fpdfapi/page/pageint.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 i2 = (int)Pop(); 336 i2 = (int)Pop();
337 Push(i1 ^ i2); 337 Push(i1 ^ i2);
338 break; 338 break;
339 case PSOP_NOT: 339 case PSOP_NOT:
340 i1 = (int)Pop(); 340 i1 = (int)Pop();
341 Push((int)!i1); 341 Push((int)!i1);
342 break; 342 break;
343 case PSOP_BITSHIFT: { 343 case PSOP_BITSHIFT: {
344 int shift = (int)Pop(); 344 int shift = (int)Pop();
345 int i = (int)Pop(); 345 int i = (int)Pop();
346 if (shift > 0) { 346 if (shift == 0) {
347 Push(i << shift); 347 Push(i);
348 } else { 348 break;
349 Push(i >> -shift);
350 } 349 }
350 if (shift < -31 || shift > 31) {
351 Push(0);
352 break;
353 }
354 uint64_t unsigned_i = i;
Tom Sepez 2016/10/20 20:55:29 think we want to do it as a signed64?
355 if (shift > 0)
356 unsigned_i <<= shift;
357 else
358 unsigned_i >>= shift;
Tom Sepez 2016/10/20 20:55:30 need a -shift here?
359 Push(static_cast<int>(unsigned_i & 0xFFFFFFFF));
351 break; 360 break;
352 } 361 }
353 case PSOP_TRUE: 362 case PSOP_TRUE:
354 Push(1); 363 Push(1);
355 break; 364 break;
356 case PSOP_FALSE: 365 case PSOP_FALSE:
357 Push(0); 366 Push(0);
358 break; 367 break;
359 case PSOP_POP: 368 case PSOP_POP:
360 Pop(); 369 Pop();
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 return m_Type == Type::kType2ExpotentialInterpolation 861 return m_Type == Type::kType2ExpotentialInterpolation
853 ? static_cast<const CPDF_ExpIntFunc*>(this) 862 ? static_cast<const CPDF_ExpIntFunc*>(this)
854 : nullptr; 863 : nullptr;
855 } 864 }
856 865
857 const CPDF_StitchFunc* CPDF_Function::ToStitchFunc() const { 866 const CPDF_StitchFunc* CPDF_Function::ToStitchFunc() const {
858 return m_Type == Type::kType3Stitching 867 return m_Type == Type::kType3Stitching
859 ? static_cast<const CPDF_StitchFunc*>(this) 868 ? static_cast<const CPDF_StitchFunc*>(this)
860 : nullptr; 869 : nullptr;
861 } 870 }
OLDNEW
« 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