aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-06-15 08:51:33 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-15 15:36:39 +0000
commit1a0882e7ee9c7929f0079d3b335efb9a664f605b (patch)
tree7001eaa028fceae33b98c2fd0ff1d1c520047c8d /samplecode
parent58564425e5acb5911cc3719f9c1e39190cc829b8 (diff)
Fix buffer overflow in SamplePathText
Bug: skia:6764 Change-Id: If0b9dba6e2bbd15ab7d94e271a0c577ca5fcf729 Reviewed-on: https://skia-review.googlesource.com/20021 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SamplePathText.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/samplecode/SamplePathText.cpp b/samplecode/SamplePathText.cpp
index bb2142ef92..023dc6dca1 100644
--- a/samplecode/SamplePathText.cpp
+++ b/samplecode/SamplePathText.cpp
@@ -354,11 +354,11 @@ void WavyPathText::Waves::reset(SkRandom& rand, int w, int h) {
}
SkPoint WavyPathText::Waves::apply(float tsec, const Sk2f matrix[3], const SkPoint& pt) const {
- constexpr static int kTableSize = 4096;
+ constexpr static int kTableSize = 1 << 12;
static float sin2table[kTableSize];
static SkOnce initTable;
initTable([]() {
- for (int i = 0; i <= kTableSize; ++i) {
+ for (int i = 0; i < kTableSize; ++i) {
const double sintheta = sin(i * (SK_ScalarPI / kTableSize));
sin2table[i] = static_cast<float>(sintheta * sintheta - 0.5);
}