mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
+++
This commit is contained in:
parent
135cba001f
commit
c2b84dc500
1 changed files with 11 additions and 10 deletions
|
@ -114,9 +114,7 @@ static LoaderResult _parseCmpTarget(const char *ptr, const char *end, Paint *pai
|
||||||
auto cmpBlock = _readBlock(ptr);
|
auto cmpBlock = _readBlock(ptr);
|
||||||
if (cmpBlock.end > end) return LoaderResult::SizeCorruption;
|
if (cmpBlock.end > end) return LoaderResult::SizeCorruption;
|
||||||
|
|
||||||
if (paint->composite(unique_ptr<Paint>(_parsePaint(cmpBlock)), cmpMethod) != Result::Success) {
|
paint->composite(unique_ptr<Paint>(), cmpMethod);
|
||||||
return LoaderResult::MemoryCorruption;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LoaderResult::Success;
|
return LoaderResult::Success;
|
||||||
}
|
}
|
||||||
|
@ -162,11 +160,12 @@ static LoaderResult _parseScene(tvgBlock block, Paint *paint)
|
||||||
|
|
||||||
if (_paintProperty(block)) return _parsePaintProperty(block, scene);
|
if (_paintProperty(block)) return _parsePaintProperty(block, scene);
|
||||||
|
|
||||||
if (scene->push(unique_ptr<Paint>(_parsePaint(block))) != Result::Success) {
|
if (auto paint = _parsePaint(block)) {
|
||||||
return LoaderResult::MemoryCorruption;
|
scene->push(unique_ptr<Paint>(paint));
|
||||||
|
return LoaderResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoaderResult::Success;
|
return LoaderResult::InvalidType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -435,11 +434,12 @@ static LoaderResult _parsePicture(tvgBlock block, Paint* paint)
|
||||||
|
|
||||||
if (_paintProperty(block)) return _parsePaintProperty(block, picture);
|
if (_paintProperty(block)) return _parsePaintProperty(block, picture);
|
||||||
|
|
||||||
if (picture->paint(unique_ptr<Paint>(_parsePaint(block))) != Result::Success) {
|
if (auto paint = _parsePaint(block)) {
|
||||||
return LoaderResult::LogicalCorruption;
|
picture->paint(unique_ptr<Paint>(paint));
|
||||||
|
return LoaderResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoaderResult::Success;
|
return LoaderResult::InvalidType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -472,7 +472,8 @@ static Paint* _parsePaint(tvgBlock baseBlock)
|
||||||
while (ptr < baseBlock.end) {
|
while (ptr < baseBlock.end) {
|
||||||
auto block = _readBlock(ptr);
|
auto block = _readBlock(ptr);
|
||||||
if (block.end > baseBlock.end) return paint;
|
if (block.end > baseBlock.end) return paint;
|
||||||
if (parser(block, paint) != LoaderResult::Success) return paint;
|
auto result = parser(block, paint);
|
||||||
|
if (result != LoaderResult::Success && result != LoaderResult::InvalidType) return paint;
|
||||||
ptr = block.end;
|
ptr = block.end;
|
||||||
}
|
}
|
||||||
return paint;
|
return paint;
|
||||||
|
|
Loading…
Add table
Reference in a new issue