/ Check-in [bb1e2c4d]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a problem in xFullPathname for the unix VFS. The problem was found by Kostya Serebryany using libFuzzer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bb1e2c4df0b81327923f121dd6c002845486a314
User & Date: drh 2015-11-30 22:22:23
Context
2015-11-30
22:52
Add the SQLITE_PRINTF_PRECISION_LIMIT compile-time option. check-in: ecad75d6 user: drh tags: trunk
22:22
Fix a problem in xFullPathname for the unix VFS. The problem was found by Kostya Serebryany using libFuzzer. check-in: bb1e2c4d user: drh tags: trunk
20:36
The EOVERFLOW errors from fstat() is not possible unless SQLite has been compiled with SQLITE_DISABLE_LFS. check-in: 8cfb7a50 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

  5977   5977     **     follows the '/'.
  5978   5978     **
  5979   5979     ** This code is written so that if the combination of the CWD and relative
  5980   5980     ** path are larger than the allocated size of zOut[] the CWD is silently
  5981   5981     ** truncated to make it fit. This is Ok, as SQLite refuses to open any
  5982   5982     ** file for which this function returns a full path larger than (nOut-8)
  5983   5983     ** bytes in size.  */
  5984         -  if( zOut[0]!='/' ){
         5984  +  testcase( nByte==nOut-5 );
         5985  +  testcase( nByte==nOut-4 );
         5986  +  if( zOut[0]!='/' && nByte<nOut-4 ){
  5985   5987       int nCwd;
  5986   5988       int nRem = nOut-nByte-1;
  5987   5989       memmove(&zOut[nRem], zOut, nByte+1);
  5988   5990       zOut[nRem-1] = '\0';
  5989   5991       if( osGetcwd(zOut, nRem-1)==0 ){
  5990   5992         return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath);
  5991   5993       }

Changes to test/symlink.test.

   111    111   } 1
   112    112   do_test 2.4 {
   113    113     file exists test.db2-wal
   114    114   } 0
   115    115   do_execsql_test 2.5 {
   116    116     SELECT * FROM t1;
   117    117   } {1 2}
          118  +
          119  +# Try to open a ridiculously long pathname.  Bug found by
          120  +# Kostya Serebryany using libFuzzer on 2015-11-30.
          121  +#
          122  +do_test 3.1 {
          123  +  db close
          124  +  catch {sqlite3 db [string repeat [string repeat x 100]/ 6]} res
          125  +  set res
          126  +} {unable to open database file}
          127  +
   118    128   
   119    129   finish_test