SQLite

Check-in [7ce93e824a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the --max-data and --max-as options to dbfuzz2. Also cause dbfuzz2 to show its maximum RSS size upon exit in standalone mode with the -v option.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7ce93e824a954d1e0cf8d7343e59a2660175f42bd4dac02aed8ad77644e7eb2f
User & Date: drh 2019-01-21 13:47:55.219
Context
2019-01-21
14:49
Minor fix the fallocate.test module change from [7cd56cad5efead5] (check-in: 94fb7a4700 user: drh tags: trunk)
13:47
Add the --max-data and --max-as options to dbfuzz2. Also cause dbfuzz2 to show its maximum RSS size upon exit in standalone mode with the -v option. (check-in: 7ce93e824a user: drh tags: trunk)
2019-01-20
00:03
Add the --max-stack option to dbfuzz2. (check-in: c11ae4fed8 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/dbfuzz2.c.
146
147
148
149
150
151
152
153



154


155
156
157
158








159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
        eVerbosity += n;
        continue;
      }
      if( strcmp(z,"vdbe-debug")==0 ){
        bVdbeDebug = 1;
        continue;
      }
      if( strcmp(z,"max-stack")==0 ){



        struct rlimit x,y;


        if( i+1==argc ){
          fprintf(stderr, "missing argument to %s\n", argv[i]);
          exit(1);
        }








        memset(&x,0,sizeof(x));
        getrlimit(RLIMIT_STACK, &x);
        y.rlim_cur = atoi(argv[++i]);
        y.rlim_max = x.rlim_cur;
        setrlimit(RLIMIT_STACK, &y);
        memset(&y,0,sizeof(y));
        getrlimit(RLIMIT_STACK, &y);
        printf("Stack size limit changed from %d to %d\n", 
               (int)x.rlim_cur, (int)y.rlim_cur);
        continue;
      }
    }
    argv[j++] = argv[i];
  }
  argv[j] = 0;
  *pArgc = j;







|
>
>
>

>
>




>
>
>
>
>
>
>
>

|


|

|
|
|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
        eVerbosity += n;
        continue;
      }
      if( strcmp(z,"vdbe-debug")==0 ){
        bVdbeDebug = 1;
        continue;
      }
      if( strcmp(z,"max-stack")==0
       || strcmp(z,"max-data")==0
       || strcmp(z,"max-as")==0
      ){
        struct rlimit x,y;
        int resource = RLIMIT_STACK;
        char *zType = "RLIMIT_STACK";
        if( i+1==argc ){
          fprintf(stderr, "missing argument to %s\n", argv[i]);
          exit(1);
        }
        if( z[4]=='d' ){
          resource = RLIMIT_DATA;
          zType = "RLIMIT_DATA";
        }
        if( z[4]=='a' ){
          resource = RLIMIT_AS;
          zType = "RLIMIT_AS";
        }
        memset(&x,0,sizeof(x));
        getrlimit(resource, &x);
        y.rlim_cur = atoi(argv[++i]);
        y.rlim_max = x.rlim_cur;
        setrlimit(resource, &y);
        memset(&y,0,sizeof(y));
        getrlimit(resource, &y);
        printf("%s changed from %d to %d\n", 
               zType, (int)x.rlim_cur, (int)y.rlim_cur);
        continue;
      }
    }
    argv[j++] = argv[i];
  }
  argv[j] = 0;
  *pArgc = j;
213
214
215
216
217
218
219

220




221
222
223
224
    pIn = readFile(argv[i], &nIn);
    if( pIn ){
      LLVMFuzzerTestOneInput((const uint8_t*)pIn, (size_t)nIn);
      free(pIn);
    }
  }
  if( eVerbosity>0 ){

    printf("SQLite %s\n", sqlite3_sourceid());




  }
  return 0;
}
#endif /*STANDALONE*/







>

>
>
>
>




226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
    pIn = readFile(argv[i], &nIn);
    if( pIn ){
      LLVMFuzzerTestOneInput((const uint8_t*)pIn, (size_t)nIn);
      free(pIn);
    }
  }
  if( eVerbosity>0 ){
    struct rusage x;
    printf("SQLite %s\n", sqlite3_sourceid());
    memset(&x, 0, sizeof(x));
    if( getrusage(RUSAGE_SELF, &x)==0 ){
      printf("Maximum RSS = %ld KB\n", x.ru_maxrss);
    }
  }
  return 0;
}
#endif /*STANDALONE*/