diff options
author | Mike Klein <mtklein@chromium.org> | 2018-03-22 11:32:09 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-22 17:19:14 +0000 |
commit | b18eb3589c8f9b99056ea358c593cf192b664c65 (patch) | |
tree | fee503fe58365916d595a43b300b7cd6f38f1ec1 /gm/pathmeasure.cpp | |
parent | 539ebb8f75b051b0f15988299bfbbf1af0cb2d61 (diff) |
add repro case for skia:7674
Nice to have something to trigger this issue.
Bug: skia:7674
Change-Id: I653699b82f3a8a4d551f3cd98b6a7e7620c6e035
Reviewed-on: https://skia-review.googlesource.com/115920
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'gm/pathmeasure.cpp')
-rw-r--r-- | gm/pathmeasure.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gm/pathmeasure.cpp b/gm/pathmeasure.cpp new file mode 100644 index 0000000000..aa7de87961 --- /dev/null +++ b/gm/pathmeasure.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2018 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkBitmap.h" +#include "SkDashPathEffect.h" +#include "SkPaint.h" +#include "SkPath.h" +#include "gm.h" + +// Repro case for skia:7674. Requires lots of RAM to run, and currently triggers UB: +// ../include/private/SkTDArray.h:382:26: +// runtime error: signed integer overflow: 2147483644 + 4 cannot be represented in type 'int' + +#if 0 +DEF_SIMPLE_GM(PathMeasure_explosion, canvas, 500,500) { + SkPaint p; + p.setAntiAlias(false); + float intervals[] = { 0, 10e9f }; + p.setStyle(SkPaint::kStroke_Style); + p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0)); + + int quadratic_at[] = { + 13, 68, 258, 1053, 1323, 2608, 10018, 15668, 59838, 557493, 696873, 871098, 4153813, + 15845608, 48357008, 118059138, 288230353, 360287948, 562949933, 703687423, 1099511613, 0 + }; + int next_quadratic_at = 0; + + SkPath path; + path.moveTo(0, 0); + + int i = 1; + for (int points = 1; points < 2147483647; ) { + if (points == quadratic_at[next_quadratic_at]) { + path.quadTo(i, 0, i, 0); + next_quadratic_at++; + points += 2; + } else { + path.lineTo(i, 0); + points += 1; + } + + i++; + + if (i == 1000000) { + path.moveTo(0, 0); + points += 1; + i = 1; + } + } + canvas->drawPath(path, p); +} +#endif |