Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/sqlite/fuzz/sqlite3_prepare_v2_fuzzer.cc

Issue 2497603002: Limit memory usage for sqlite3 fuzzer + move it to sqlite dir. (Closed)
Patch Set: Fix nits. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/BUILD.gn ('k') | third_party/sqlite/fuzz/sqlite3_prepare_v2_fuzzer.dict » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <array> 9 #include <array>
10 #include <string> 10 #include <string>
(...skipping 29 matching lines...) Expand all
40 40
41 if (checkForBadKeyword(data, size)) 41 if (checkForBadKeyword(data, size))
42 return 0; 42 return 0;
43 43
44 sqlite3* db; 44 sqlite3* db;
45 int return_code = sqlite3_open_v2( 45 int return_code = sqlite3_open_v2(
46 "db.db", 46 "db.db",
47 &db, 47 &db,
48 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY, 0); 48 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY, 0);
49 49
50
51 if (SQLITE_OK != return_code) 50 if (SQLITE_OK != return_code)
52 return 0; 51 return 0;
53 52
54 // Use first byte as random selector for other parameters. 53 // Use first byte as random selector for other parameters.
55 int selector = data[0]; 54 int selector = data[0];
56 55
57 // To cover both cases when progress_handler is used and isn't used. 56 // To cover both cases when progress_handler is used and isn't used.
58 if (selector & 1) 57 if (selector & 1)
59 sqlite3_progress_handler(db, 4, &Progress, NULL); 58 sqlite3_progress_handler(db, 4, &Progress, NULL);
60 else 59 else
(...skipping 11 matching lines...) Expand all
72 if (sqlite3_step(statement) != SQLITE_ROW) 71 if (sqlite3_step(statement) != SQLITE_ROW)
73 break; 72 break;
74 } 73 }
75 74
76 sqlite3_finalize(statement); 75 sqlite3_finalize(statement);
77 } 76 }
78 77
79 sqlite3_close(db); 78 sqlite3_close(db);
80 return 0; 79 return 0;
81 } 80 }
OLDNEW
« no previous file with comments | « third_party/sqlite/BUILD.gn ('k') | third_party/sqlite/fuzz/sqlite3_prepare_v2_fuzzer.dict » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698