mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
sw_engine: ++exception handling
Prevent the infinite loop in the worst case @Issue: https://github.com/thorvg/thorvg/issues/2651
This commit is contained in:
parent
03bbfd3183
commit
52def8dc27
1 changed files with 5 additions and 0 deletions
|
@ -558,7 +558,12 @@ static void _lineTo(RleWorker& rw, const SwPoint& to)
|
||||||
/* The fundamental value `prod' determines which side and the */
|
/* The fundamental value `prod' determines which side and the */
|
||||||
/* exact coordinate where the line exits current cell. It is */
|
/* exact coordinate where the line exits current cell. It is */
|
||||||
/* also easily updated when moving from one cell to the next. */
|
/* also easily updated when moving from one cell to the next. */
|
||||||
|
size_t idx = 0;
|
||||||
do {
|
do {
|
||||||
|
if (++idx > 1000000000) {
|
||||||
|
TVGERR("SW_ENGINE", "Iteration limit reached during RLE generation. The resulting render may be incorrect.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
auto px = diff.x * ONE_PIXEL;
|
auto px = diff.x * ONE_PIXEL;
|
||||||
auto py = diff.y * ONE_PIXEL;
|
auto py = diff.y * ONE_PIXEL;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue