skia2/gn
John Stiles 5cec187b36 Fix array timeout discovered by the fuzzer.
The fuzzer discovered that, when we attempt to verify that an array
doesn't contain any literal values that are out-of-range for its base
type, we pay a linear-time cost based on the size of the array. This
happens even when the array value isn't known at compile time; we still
iterate over its slot count and diligently discover that every single
constant-subexpression slot in the expression is "null".

We now have a helper function on Expression,
`allowsConstantSubexpressions`, which only returns true for expression
kinds that can contain constant subexpressions. We use this helper to
skip over this linear-per-subexpression check when the expression
cannot possibly contain a constant subexpression. In particular,
`AnyConstructor::compareConstant` and `Type::checkForOutOfRangeLiteral`
will now early-out for expressions that can't possibly contain a
constant subexpression.

Change-Id: Ia34e422afa67b478a8616acb0a0e9cd211b29698
Bug: oss-fuzz:37900
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444136
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-08-31 19:55:45 +00:00
..
portable Separate general defaults from Skia defaults 2021-03-22 15:30:56 +00:00
skia Enable variable-shadow warnings. 2021-08-16 18:06:06 +00:00
toolchain allow overriding {target,host}_link = ... in GN 2020-11-05 19:40:47 +00:00
__init__.py Make gn directory importable in python 2017-03-20 17:40:30 +00:00
bench.gni Non-substantive changes for making v1::SurfaceDrawContext V1-only 2021-08-02 19:22:58 +00:00
BUILDCONFIG.gn Separate general defaults from Skia defaults 2021-03-22 15:30:56 +00:00
call.py [minor] mark scripts as executable 2019-11-21 17:06:27 +00:00
checkdir.py fix print functions for python3 gn scripts 2020-03-06 17:42:39 +00:00
checkpath.py Python3 tweaks 2019-12-17 17:12:03 +00:00
codesign_ios.py Update code-signing script to have better error messages. 2020-11-09 18:41:36 +00:00
compile_ib_files.py Reland "Add launch screen to iOS apps" 2019-09-05 14:05:08 +00:00
compile_sksl_tests.py Remove (unused) geometry shader support 2021-08-27 19:41:10 +00:00
copy_git_directory.py GN tools: copy_git_directory.py better error message. 2019-11-19 17:04:18 +00:00
core.gni Move GrBlockAllocator and GrTBlockList to src/core/ 2021-08-25 13:21:32 +00:00
cp.py Work around python 2 shutil.copy2 date bug 2020-09-28 20:12:13 +00:00
dehydrate_sksl.py quiet dehyrdate_sksl unless it fails 2021-01-08 18:14:29 +00:00
effects_imagefilters.gni Rudimentary SkRuntimeImageFilter 2021-06-09 21:46:24 +00:00
effects.gni Arithmetic blender 2021-07-08 17:06:17 +00:00
find_headers.py Python3 tweaks 2019-12-17 17:12:03 +00:00
find_msvc.py Add Preview to list of possible MSVC versions. 2020-04-30 19:54:33 +00:00
find_xcode_sysroot.py fix print functions for python3 gn scripts 2020-03-06 17:42:39 +00:00
flutter_defines.gni rm flutter support for filterquality 2021-07-17 14:39:38 +00:00
fuchsia_defines.gni Enable new clip stack for Fuchsia 2020-10-12 20:41:03 +00:00
gen_plist_ios.py Add product bundle name to iOS Xcode projects 2020-11-16 16:00:56 +00:00
gm.gni Create test case to repro skia:12212. 2021-07-30 17:41:13 +00:00
gn_meta_sln.py fix print functions for python3 gn scripts 2020-03-06 17:42:39 +00:00
gn_to_bp_utils.py Update gn_to_bp_utils to support python3 2021-08-03 17:52:43 +00:00
gn_to_bp.py Ease HarfBuzz API change with feature detection 2021-08-06 17:22:22 +00:00
gn_to_cmake.py Fix CMakeLists to find Emscripten headers 2021-04-16 16:45:22 +00:00
gpu.gni Rename some GrD3DTypes* header files. 2021-08-31 18:49:46 +00:00
highest_version_dir.py fix print functions for python3 gn scripts 2020-03-06 17:42:39 +00:00
ios.gni Fix iOS build for skpinfo. 2021-06-18 20:53:06 +00:00
is_clang.py Fix is_clang python3 encoding errors 2020-06-26 18:41:00 +00:00
make_gm_gni.py GMs: re-sort gni, script to regenerate gni, file name convention 2019-05-02 20:08:37 +00:00
opts.gni add structure for normal SKX opts 2020-06-05 13:48:39 +00:00
pdf.gni Make skia_use_xps option work on Windows 2020-03-24 17:09:33 +00:00
push_to_android.py skia_android_serial = "auto" 2017-01-12 16:30:17 +00:00
rm.py Delete .a file before writing static library. 2020-06-11 17:19:23 +00:00
run_sksllex.py Reland "Fetch clang-format automatically when compiling .fp files." 2020-06-12 13:21:41 +00:00
samples.gni Prepare headers for making all ops V1-only 2021-08-12 15:09:11 +00:00
shared_sources.gni add structure for normal SKX opts 2020-06-05 13:48:39 +00:00
skia.gni Ease HarfBuzz API change with feature detection 2021-08-06 17:22:22 +00:00
sksl_tests.gni Fix array timeout discovered by the fuzzer. 2021-08-31 19:55:45 +00:00
sksl.gni Migrate function-body finalization out of IRGenerator. 2021-08-27 18:51:52 +00:00
tests.gni Move GrBlockAllocator and GrTBlockList to src/core/ 2021-08-25 13:21:32 +00:00
utils.gni OrderedFontMgr utility 2021-04-27 18:10:41 +00:00
xps.gni harmonize rewrite-includes and gn-format checks 2020-04-03 17:00:54 +00:00