SQLite

Check-in [d655a665ac]
Login

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

Overview
Comment:Limit the length of sqlite3_mprintf() output to 2^30 bytes, even if SQLITE_MAX_LENGTH is set larger at compile-time.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d655a665acfae676d30e90e3731f483bee6acc63
User & Date: drh 2016-01-04 04:28:11.861
References
2016-01-04
12:07
A new approach to very large sqlite3_mprintf() strings: Back out the [d655a665] check-in and instead make the size fields in StrAccum unsigned. Strings generated by sqlite3_mprintf() can now be as large as 2^31-1 bytes. (check-in: 7adb789f45 user: drh tags: trunk)
Context
2016-01-04
04:41
Adjust the vtabH.test module to ignore files in the root directory of Windows machines that contain the "$" character. (check-in: 73e3355004 user: drh tags: trunk)
04:28
Limit the length of sqlite3_mprintf() output to 2^30 bytes, even if SQLITE_MAX_LENGTH is set larger at compile-time. (check-in: d655a665ac user: drh tags: trunk)
03:48
Fix a harmless compiler warning. (check-in: 4b404a99aa user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/printf.c.
961
962
963
964
965
966
967

968




969
970
971
972
973
974
975
    (void)SQLITE_MISUSE_BKPT;
    return 0;
  }
#endif
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif

  sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);




  sqlite3VXPrintf(&acc, 0, zFormat, ap);
  z = sqlite3StrAccumFinish(&acc);
  return z;
}

/*
** Print into memory obtained from sqlite3_malloc()().  Omit the internal







>

>
>
>
>







961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
    (void)SQLITE_MISUSE_BKPT;
    return 0;
  }
#endif
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif
#if SQLITE_MAX_LENGTH<0x40000000
  sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
#else
  sqlite3StrAccumInit(&acc, 0, zBase, sizeof(zBase), 0x3fffffff);
#endif

  sqlite3VXPrintf(&acc, 0, zFormat, ap);
  z = sqlite3StrAccumFinish(&acc);
  return z;
}

/*
** Print into memory obtained from sqlite3_malloc()().  Omit the internal