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

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

Issue 162943003: Fixed clusterfuzz found crash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added early return Created 6 years, 10 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 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 buffer.writeInt(SERIALIZE_PIXELTYPE_NONE); 1559 buffer.writeInt(SERIALIZE_PIXELTYPE_NONE);
1560 } 1560 }
1561 } 1561 }
1562 1562
1563 void SkBitmap::unflatten(SkReadBuffer& buffer) { 1563 void SkBitmap::unflatten(SkReadBuffer& buffer) {
1564 this->reset(); 1564 this->reset();
1565 1565
1566 SkImageInfo info; 1566 SkImageInfo info;
1567 info.unflatten(buffer); 1567 info.unflatten(buffer);
1568 size_t rowBytes = buffer.readInt(); 1568 size_t rowBytes = buffer.readInt();
1569 buffer.validate((info.width() >= 0) && (info.height() >= 0) && 1569 if (!buffer.validate((info.width() >= 0) && (info.height() >= 0) &&
1570 SkColorTypeIsValid(info.fColorType) && 1570 SkColorTypeIsValid(info.fColorType) &&
1571 SkAlphaTypeIsValid(info.fAlphaType) && 1571 SkAlphaTypeIsValid(info.fAlphaType) &&
1572 validate_alphaType(info.fColorType, info.fAlphaType) && 1572 validate_alphaType(info.fColorType, info.fAlphaType) &&
1573 info.validRowBytes(rowBytes)); 1573 info.validRowBytes(rowBytes))) {
1574 return;
1575 }
1574 1576
1575 bool configIsValid = this->setConfig(info, rowBytes); 1577 bool configIsValid = this->setConfig(info, rowBytes);
1576 buffer.validate(configIsValid); 1578 buffer.validate(configIsValid);
1577 1579
1578 int reftype = buffer.readInt(); 1580 int reftype = buffer.readInt();
1579 if (buffer.validate((SERIALIZE_PIXELTYPE_REF_DATA == reftype) || 1581 if (buffer.validate((SERIALIZE_PIXELTYPE_REF_DATA == reftype) ||
1580 (SERIALIZE_PIXELTYPE_NONE == reftype))) { 1582 (SERIALIZE_PIXELTYPE_NONE == reftype))) {
1581 switch (reftype) { 1583 switch (reftype) {
1582 case SERIALIZE_PIXELTYPE_REF_DATA: { 1584 case SERIALIZE_PIXELTYPE_REF_DATA: {
1583 SkIPoint origin; 1585 SkIPoint origin;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 /////////////////////////////////////////////////////////////////////////////// 1686 ///////////////////////////////////////////////////////////////////////////////
1685 1687
1686 #ifdef SK_DEBUG 1688 #ifdef SK_DEBUG
1687 void SkImageInfo::validate() const { 1689 void SkImageInfo::validate() const {
1688 SkASSERT(fWidth >= 0); 1690 SkASSERT(fWidth >= 0);
1689 SkASSERT(fHeight >= 0); 1691 SkASSERT(fHeight >= 0);
1690 SkASSERT(SkColorTypeIsValid(fColorType)); 1692 SkASSERT(SkColorTypeIsValid(fColorType));
1691 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1693 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1692 } 1694 }
1693 #endif 1695 #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