OLD | NEW |
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 "SkOncePtr.h" | 9 #include "SkOncePtr.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 | 132 |
133 ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1; | 133 ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1; |
134 uint8_t segmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF; | 134 uint8_t segmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF; |
135 bool isOval = (packed >> kIsOval_SerializationShift) & 1; | 135 bool isOval = (packed >> kIsOval_SerializationShift) & 1; |
136 bool isRRect = (packed >> kIsRRect_SerializationShift) & 1; | 136 bool isRRect = (packed >> kIsRRect_SerializationShift) & 1; |
137 | 137 |
138 int32_t verbCount, pointCount, conicCount; | 138 int32_t verbCount, pointCount, conicCount; |
139 if (!buffer->readU32(&(ref->fGenerationID)) || | 139 if (!buffer->readU32(&(ref->fGenerationID)) || |
140 !buffer->readS32(&verbCount) || | 140 !buffer->readS32(&verbCount) || |
| 141 verbCount < 0 || |
141 !buffer->readS32(&pointCount) || | 142 !buffer->readS32(&pointCount) || |
142 !buffer->readS32(&conicCount)) { | 143 pointCount < 0 || |
| 144 !buffer->readS32(&conicCount) || |
| 145 conicCount < 0) { |
143 delete ref; | 146 delete ref; |
144 return nullptr; | 147 return nullptr; |
145 } | 148 } |
146 | 149 |
147 ref->resetToSize(verbCount, pointCount, conicCount); | 150 ref->resetToSize(verbCount, pointCount, conicCount); |
148 SkASSERT(verbCount == ref->countVerbs()); | 151 SkASSERT(verbCount == ref->countVerbs()); |
149 SkASSERT(pointCount == ref->countPoints()); | 152 SkASSERT(pointCount == ref->countPoints()); |
150 SkASSERT(conicCount == ref->fConicWeights.count()); | 153 SkASSERT(conicCount == ref->fConicWeights.count()); |
151 | 154 |
152 if (!buffer->read(ref->verbsMemWritable(), verbCount * sizeof(uint8_t)) || | 155 if (!buffer->read(ref->verbsMemWritable(), verbCount * sizeof(uint8_t)) || |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 break; | 648 break; |
646 default: | 649 default: |
647 SkDEBUGFAIL("Unknown Verb"); | 650 SkDEBUGFAIL("Unknown Verb"); |
648 break; | 651 break; |
649 } | 652 } |
650 } | 653 } |
651 SkASSERT(mask == fSegmentMask); | 654 SkASSERT(mask == fSegmentMask); |
652 #endif // SK_DEBUG_PATH | 655 #endif // SK_DEBUG_PATH |
653 } | 656 } |
654 #endif | 657 #endif |
OLD | NEW |