SQLite

Check-in [bb1e2c4df0]
Login

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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bb1e2c4df0b81327923f121dd6c002845486a314
User & Date: drh 2015-11-30 22:22:23.455
Context
2015-11-30
22:52
Add the SQLITE_PRINTF_PRECISION_LIMIT compile-time option. (check-in: ecad75d69e 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: bb1e2c4df0 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: 8cfb7a50bb user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
5977
5978
5979
5980
5981
5982
5983


5984
5985
5986
5987
5988
5989
5990
5991
  **     follows the '/'.
  **
  ** This code is written so that if the combination of the CWD and relative
  ** path are larger than the allocated size of zOut[] the CWD is silently
  ** truncated to make it fit. This is Ok, as SQLite refuses to open any
  ** file for which this function returns a full path larger than (nOut-8)
  ** bytes in size.  */


  if( zOut[0]!='/' ){
    int nCwd;
    int nRem = nOut-nByte-1;
    memmove(&zOut[nRem], zOut, nByte+1);
    zOut[nRem-1] = '\0';
    if( osGetcwd(zOut, nRem-1)==0 ){
      return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath);
    }







>
>
|







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










118
119
} 1
do_test 2.4 {
  file exists test.db2-wal
} 0
do_execsql_test 2.5 {
  SELECT * FROM t1;
} {1 2}











finish_test







>
>
>
>
>
>
>
>
>
>


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
} 1
do_test 2.4 {
  file exists test.db2-wal
} 0
do_execsql_test 2.5 {
  SELECT * FROM t1;
} {1 2}

# Try to open a ridiculously long pathname.  Bug found by
# Kostya Serebryany using libFuzzer on 2015-11-30.
#
do_test 3.1 {
  db close
  catch {sqlite3 db [string repeat [string repeat x 100]/ 6]} res
  set res
} {unable to open database file}


finish_test