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

Side by Side Diff: src/core/SkPathRef.cpp

Issue 801003003: Harden validation for SkPathRef (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkLazyPtr.h" 9 #include "SkLazyPtr.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace)); 445 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
446 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace)); 446 SkASSERT(!(NULL == fPoints && 0 != fFreeSpace));
447 SkASSERT(!(NULL == fPoints && fPointCnt)); 447 SkASSERT(!(NULL == fPoints && fPointCnt));
448 SkASSERT(!(NULL == fVerbs && fVerbCnt)); 448 SkASSERT(!(NULL == fVerbs && fVerbCnt));
449 SkASSERT(this->currSize() == 449 SkASSERT(this->currSize() ==
450 fFreeSpace + sizeof(SkPoint) * fPointCnt + sizeof(uint8_t) * fVe rbCnt); 450 fFreeSpace + sizeof(SkPoint) * fPointCnt + sizeof(uint8_t) * fVe rbCnt);
451 451
452 if (!fBoundsIsDirty && !fBounds.isEmpty()) { 452 if (!fBoundsIsDirty && !fBounds.isEmpty()) {
453 bool isFinite = true; 453 bool isFinite = true;
454 for (int i = 0; i < fPointCnt; ++i) { 454 for (int i = 0; i < fPointCnt; ++i) {
455 SkASSERT(!fPoints[i].isFinite() || ( 455 SkASSERT(!fPoints[i].isFinite() ||
456 fBounds.fLeft - fPoints[i].fX < SK_ScalarNearlyZero && 456 » » (fPoints[i].fX >= fBounds.fLeft && fPoints[i].fX <= fBounds .fRight &&
457 fPoints[i].fX - fBounds.fRight < SK_ScalarNearlyZero && 457 » » fPoints[i].fY >= fBounds.fTop && fPoints[i].fY <= fBounds. fBottom));
458 fBounds.fTop - fPoints[i].fY < SK_ScalarNearlyZero &&
459 fPoints[i].fY - fBounds.fBottom < SK_ScalarNearlyZero));
460 if (!fPoints[i].isFinite()) { 458 if (!fPoints[i].isFinite()) {
461 isFinite = false; 459 isFinite = false;
462 } 460 }
463 } 461 }
464 SkASSERT(SkToBool(fIsFinite) == isFinite); 462 SkASSERT(SkToBool(fIsFinite) == isFinite);
465 } 463 }
466 464
467 #ifdef SK_DEBUG_PATH 465 #ifdef SK_DEBUG_PATH
468 uint32_t mask = 0; 466 uint32_t mask = 0;
469 for (int i = 0; i < fVerbCnt; ++i) { 467 for (int i = 0; i < fVerbCnt; ++i) {
(...skipping 19 matching lines...) Expand all
489 break; 487 break;
490 default: 488 default:
491 SkDEBUGFAIL("Unknown Verb"); 489 SkDEBUGFAIL("Unknown Verb");
492 break; 490 break;
493 } 491 }
494 } 492 }
495 SkASSERT(mask == fSegmentMask); 493 SkASSERT(mask == fSegmentMask);
496 #endif // SK_DEBUG_PATH 494 #endif // SK_DEBUG_PATH
497 } 495 }
498 #endif 496 #endif
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