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

Side by Side Diff: third_party/sqlite/src/test/ossshell.c

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months 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/src/test/ossfuzz.c ('k') | third_party/sqlite/src/test/ovfl.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 ** This is a test interface for the ossfuzz.c module. The ossfuzz.c module
3 ** is an adaptor for OSS-FUZZ. (https://github.com/google/oss-fuzz)
4 **
5 ** This program links against ossfuzz.c. It reads files named on the
6 ** command line and passes them one by one into ossfuzz.c.
7 */
8 #include <stddef.h>
9 #include <stdint.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include "sqlite3.h"
13
14 /*
15 ** The entry point in ossfuzz.c that this routine will be calling
16 */
17 int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
18
19
20 /*
21 ** Read files named on the command-line and invoke the fuzzer for
22 ** each one.
23 */
24 int main(int argc, char **argv){
25 FILE *in;
26 int i;
27 int nErr = 0;
28 uint8_t *zBuf = 0;
29 size_t sz;
30
31 for(i=1; i<argc; i++){
32 const char *zFilename = argv[i];
33 in = fopen(zFilename, "rb");
34 if( in==0 ){
35 fprintf(stderr, "cannot open \"%s\"\n", zFilename);
36 nErr++;
37 continue;
38 }
39 fseek(in, 0, SEEK_END);
40 sz = ftell(in);
41 rewind(in);
42 zBuf = realloc(zBuf, sz);
43 if( zBuf==0 ){
44 fprintf(stderr, "cannot malloc() for %d bytes\n", (int)sz);
45 exit(1);
46 }
47 if( fread(zBuf, sz, 1, in)!=1 ){
48 fprintf(stderr, "cannot read %d bytes from \"%s\"\n",
49 (int)sz, zFilename);
50 nErr++;
51 }else{
52 printf("%s... ", zFilename);
53 fflush(stdout);
54 (void)LLVMFuzzerTestOneInput(zBuf, sz);
55 printf("ok\n");
56 }
57 fclose(in);
58 }
59 free(zBuf);
60 return nErr;
61 }
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/ossfuzz.c ('k') | third_party/sqlite/src/test/ovfl.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698