Fix stack overuse error
authorhalcanary <halcanary@google.com>
Wed, 19 Aug 2015 13:12:40 +0000 (06:12 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 19 Aug 2015 13:12:40 +0000 (06:12 -0700)
Review URL: https://codereview.chromium.org/1283193008

tests/StreamTest.cpp

index 78c0e50..08adf14 100644 (file)
@@ -381,15 +381,15 @@ static void stream_copy_test(skiatest::Reporter* reporter,
 
 DEF_TEST(StreamCopy, reporter) {
     SkRandom random(123456);
-    static const size_t N = 10000;
-    uint8_t src[N];
-    for (size_t j = 0; j < N; ++j) {
+    static const int N = 10000;
+    SkAutoTMalloc<uint8_t> src((size_t)N);
+    for (int j = 0; j < N; ++j) {
         src[j] = random.nextU() & 0xff;
     }
     // SkStreamCopy had two code paths; this test both.
-    DumbStream dumbStream(srcN);
+    DumbStream dumbStream(src.get(), (size_t)N);
     stream_copy_test(reporter, src, N, &dumbStream);
-    SkMemoryStream smartStream(srcN);
+    SkMemoryStream smartStream(src.get(), (size_t)N);
     stream_copy_test(reporter, src, N, &smartStream);
 
 }