skia2/resources/sksl/runtime/LargeProgram_StackDepth.rts
John Stiles 2af4b13925 Reject programs which exceed 50 stack frames during size analysis.
Our program-size analysis pass needs to recurse into called functions;
depending on the exact order of functions in the program, this recursion
can hypothetically be as deep as the deepest function-call chain. Set an
upper bound on recursion here, so we don't overflow the stack while
trying to check the program size. In practice, 50 frames is far deeper
than a regular shader should ever go.

Change-Id: I733ee48dad6f8053facdfd9f6d8a2b9b2a4af188
Bug: skia:12396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/445279
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-09-03 02:41:34 +00:00

58 lines
1.1 KiB
Plaintext

half4 color;
void f1();
half4 main(float2 xy) {
f1();
return color;
}
void f49() { color = half4(1); }
void f48() { f49(); }
void f47() { f48(); }
void f46() { f47(); }
void f45() { f46(); }
void f44() { f45(); }
void f43() { f44(); }
void f42() { f43(); }
void f41() { f42(); }
void f40() { f41(); }
void f39() { f40(); }
void f38() { f39(); }
void f37() { f38(); }
void f36() { f37(); }
void f35() { f36(); }
void f34() { f35(); }
void f33() { f34(); }
void f32() { f33(); }
void f31() { f32(); }
void f30() { f31(); }
void f29() { f30(); }
void f28() { f29(); }
void f27() { f28(); }
void f26() { f27(); }
void f25() { f26(); }
void f24() { f25(); }
void f23() { f24(); }
void f22() { f23(); }
void f21() { f22(); }
void f20() { f21(); }
void f19() { f20(); }
void f18() { f19(); }
void f17() { f18(); }
void f16() { f17(); }
void f15() { f16(); }
void f14() { f15(); }
void f13() { f14(); }
void f12() { f13(); }
void f11() { f12(); }
void f10() { f11(); }
void f9() { f10(); }
void f8() { f9(); }
void f7() { f8(); }
void f6() { f7(); }
void f5() { f6(); }
void f4() { f5(); }
void f3() { f4(); }
void f2() { f3(); }
void f1() { f2(); }