OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//testing/libfuzzer/fuzzer_test.gni") | 5 import("//testing/libfuzzer/fuzzer_test.gni") |
6 | 6 |
7 declare_args() { | 7 declare_args() { |
8 # Controls whether the build should uses the version of sqlite3 library | 8 # Controls whether the build should uses the version of sqlite3 library |
9 # shipped with the system (currently only supported on iOS) or the one | 9 # shipped with the system (currently only supported on iOS) or the one |
10 # shipped with Chromium source. | 10 # shipped with Chromium source. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 defines += [ "_HAVE_SQLITE_CONFIG_H" ] | 130 defines += [ "_HAVE_SQLITE_CONFIG_H" ] |
131 } | 131 } |
132 | 132 |
133 if (using_sanitizer) { | 133 if (using_sanitizer) { |
134 # Limit max length of data blobs and queries for fuzzing builds by 128 MB. | 134 # Limit max length of data blobs and queries for fuzzing builds by 128 MB. |
135 defines += [ | 135 defines += [ |
136 "SQLITE_MAX_LENGTH=128000000", | 136 "SQLITE_MAX_LENGTH=128000000", |
137 "SQLITE_MAX_SQL_LENGTH=128000000", | 137 "SQLITE_MAX_SQL_LENGTH=128000000", |
138 "SQLITE_PRINTF_PRECISION_LIMIT=1280000", | 138 "SQLITE_PRINTF_PRECISION_LIMIT=1280000", |
139 ] | 139 ] |
| 140 |
| 141 # During fuzz testing, valid SQL queries generated by fuzzing engine may |
| 142 # lead to large memory allocations. If that happens, fuzzer reports an |
| 143 # out-of-memory error. However, such errors are not valid bugs. |
| 144 # To avoid hitting those irrelevant OOMs, we limit max number of memory |
| 145 # pages, so fuzzer will not crash when reaching the limit. |
| 146 # Apply this for fuzzing builds only, not for all builds with sanitizers. |
| 147 if (use_libfuzzer || use_afl) { |
| 148 defines += [ "SQLITE_MAX_PAGE_COUNT=16384" ] |
| 149 } |
140 } | 150 } |
141 | 151 |
142 include_dirs = [ "amalgamation" ] | 152 include_dirs = [ "amalgamation" ] |
143 | 153 |
144 configs -= [ "//build/config/compiler:chromium_code" ] | 154 configs -= [ "//build/config/compiler:chromium_code" ] |
145 configs += [ | 155 configs += [ |
146 "//build/config/compiler:no_chromium_code", | 156 "//build/config/compiler:no_chromium_code", |
147 | 157 |
148 # Must be after no_chromium_code for warning flags to be ordered | 158 # Must be after no_chromium_code for warning flags to be ordered |
149 # correctly. | 159 # correctly. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 fuzzer_test("sqlite3_ossfuzz_fuzzer") { | 290 fuzzer_test("sqlite3_ossfuzz_fuzzer") { |
281 # TODO(mmoroz, shess): remove fuzz/ossfuzz.c after next sqlite3 update. | 291 # TODO(mmoroz, shess): remove fuzz/ossfuzz.c after next sqlite3 update. |
282 sources = [ | 292 sources = [ |
283 "fuzz/ossfuzz.c", | 293 "fuzz/ossfuzz.c", |
284 ] | 294 ] |
285 deps = [ | 295 deps = [ |
286 ":sqlite", | 296 ":sqlite", |
287 ] | 297 ] |
288 dict = "fuzz/sql.dict" | 298 dict = "fuzz/sql.dict" |
289 } | 299 } |
OLD | NEW |