Index: third_party/sqlite/BUILD.gn |
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn |
index 4acbd3a321184a17c7c4b68f5630066ede7f7a99..367b1f03998423f89c0dc03edb291013f703d450 100644 |
--- a/third_party/sqlite/BUILD.gn |
+++ b/third_party/sqlite/BUILD.gn |
@@ -137,6 +137,16 @@ if (!use_system_sqlite) { |
"SQLITE_MAX_SQL_LENGTH=128000000", |
"SQLITE_PRINTF_PRECISION_LIMIT=1280000", |
] |
+ |
+ # During fuzz testing, valid SQL queries generated by fuzzing engine may |
+ # lead to large memory allocations. If that happens, fuzzer reports an |
+ # out-of-memory error. However, such errors are not valid bugs. |
+ # To avoid hitting those irrelevant OOMs, we limit max number of memory |
+ # pages, so fuzzer will not crash when reaching the limit. |
+ # Apply this for fuzzing builds only, not for all builds with sanitizers. |
+ if (use_libfuzzer || use_afl) { |
+ defines += [ "SQLITE_MAX_PAGE_COUNT=16384" ] |
+ } |
} |
include_dirs = [ "amalgamation" ] |