mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
svg_loader SvgPath: Skip invalid path
If the d attribute of SVG path is not parsed through _nextCommand(), it is regarded as an invalid data.
This commit is contained in:
parent
bbc0fbb130
commit
233045f796
1 changed files with 4 additions and 3 deletions
|
@ -286,7 +286,7 @@ static int _numberCount(char cmd)
|
|||
}
|
||||
|
||||
|
||||
static void _processCommand(Array<PathCommand>* cmds, Array<Point>* pts, char cmd, float* arr, int count, Point* cur, Point* curCtl, Point* startPoint, bool *isQuadratic)
|
||||
static bool _processCommand(Array<PathCommand>* cmds, Array<Point>* pts, char cmd, float* arr, int count, Point* cur, Point* curCtl, Point* startPoint, bool *isQuadratic)
|
||||
{
|
||||
switch (cmd) {
|
||||
case 'm':
|
||||
|
@ -449,9 +449,10 @@ static void _processCommand(Array<PathCommand>* cmds, Array<Point>* pts, char cm
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -525,7 +526,7 @@ bool svgPathToTvgPath(const char* svgPath, Array<PathCommand>& cmds, Array<Point
|
|||
while ((path[0] != '\0')) {
|
||||
path = _nextCommand(path, &cmd, numberArray, &numberCount);
|
||||
if (!path) break;
|
||||
_processCommand(&cmds, &pts, cmd, numberArray, numberCount, &cur, &curCtl, &startPoint, &isQuadratic);
|
||||
if (!_processCommand(&cmds, &pts, cmd, numberArray, numberCount, &cur, &curCtl, &startPoint, &isQuadratic)) break;
|
||||
}
|
||||
|
||||
setlocale(LC_NUMERIC, curLocale);
|
||||
|
|
Loading…
Add table
Reference in a new issue