SQLite

Check-in [f74899ed2c]
Login

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

Overview
Comment:Set a reasonable limit on the number of opcodes in a prepared statement for ossfuzz.c. This should prevent timeouts in OSS-Fuzz when it generates totally unreasonable queries.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f74899ed2c78019abb406432a74dcd42a0ff8d9add005f8544dc4a8905f232eb
User & Date: drh 2017-03-17 22:51:28.665
Context
2017-03-17
23:08
Fix an error in the newly revised documentation for SQLITE_LIMIT_VDBE_OP. No changes to code. (check-in: f4cf8635e6 user: drh tags: trunk)
22:51
Set a reasonable limit on the number of opcodes in a prepared statement for ossfuzz.c. This should prevent timeouts in OSS-Fuzz when it generates totally unreasonable queries. (check-in: f74899ed2c user: drh tags: trunk)
22:50
Begin enforcing the SQLITE_LIMIT_VDBE_OP. The documentation warned that this day might come. (check-in: ef59146170 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/ossfuzz.c.
116
117
118
119
120
121
122



123
124
125
126
127
128
129
  ** (which will block further processing) if more than 10 seconds have
  ** elapsed since the start of the test.
  */
  cx.iLastCb = timeOfDay();
  cx.iCutoffTime = cx.iLastCb + 10000;  /* Now + 10 seconds */
  sqlite3_progress_handler(cx.db, 10, progress_handler, (void*)&cx);
#endif




  /* Bit 1 of the selector enables foreign key constraints */
  sqlite3_db_config(cx.db, SQLITE_DBCONFIG_ENABLE_FKEY, uSelector&1, &rc);
  uSelector >>= 1;

  /* Remaining bits of the selector determine a limit on the number of
  ** output rows */







>
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
  ** (which will block further processing) if more than 10 seconds have
  ** elapsed since the start of the test.
  */
  cx.iLastCb = timeOfDay();
  cx.iCutoffTime = cx.iLastCb + 10000;  /* Now + 10 seconds */
  sqlite3_progress_handler(cx.db, 10, progress_handler, (void*)&cx);
#endif

  /* Set a limit on the maximum size of a prepared statement */
  sqlite3_limit(cx.db, SQLITE_LIMIT_VDBE_OP, 25000);

  /* Bit 1 of the selector enables foreign key constraints */
  sqlite3_db_config(cx.db, SQLITE_DBCONFIG_ENABLE_FKEY, uSelector&1, &rc);
  uSelector >>= 1;

  /* Remaining bits of the selector determine a limit on the number of
  ** output rows */