From 5f5719bd0773621aed7e2de9c7bd000b5ecd27ad Mon Sep 17 00:00:00 2001 From: larrybr Date: Thu, 29 Apr 2021 19:30:35 +0000 Subject: [PATCH] Reduce API lifetime requirement for objects passed to sqlite3_bind_...() with SQLITE_STATIC. Also fix broken session doc links (by zapping refs.) FossilOrigin-Name: 327eb4792f9b98f6220fd35ba744002d36ed53f43a016924117b3cea32343947 --- ext/session/sqlite3session.h | 17 +++++++++-------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/sqlite.h.in | 28 ++++++++++++++++------------ 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/ext/session/sqlite3session.h b/ext/session/sqlite3session.h index e4aed9a252..10d0133901 100644 --- a/ext/session/sqlite3session.h +++ b/ext/session/sqlite3session.h @@ -86,14 +86,11 @@ void sqlite3session_delete(sqlite3_session *pSession); ** This method is used to configure a session object after it has been ** created. At present the only valid value for the second parameter is ** [SQLITE_SESSION_OBJCONFIG_SIZE]. -*/ -int sqlite3session_object_config(sqlite3_session*, int op, void *pArg); - -/* -** CAPI3REF: Arguments for sqlite3session_object_config() +** +** Arguments for sqlite3session_object_config() ** ** The following values may passed as the the 4th parameter to -** [sqlite3session_object_config]. +** sqlite3session_object_config(). ** **
SQLITE_SESSION_OBJCONFIG_SIZE
** This option is used to set, clear or query the flag that enables @@ -109,6 +106,10 @@ int sqlite3session_object_config(sqlite3_session*, int op, void *pArg); ** It is an error (SQLITE_MISUSE) to attempt to modify this setting after ** the first table has been attached to the session object. */ +int sqlite3session_object_config(sqlite3_session*, int op, void *pArg); + +/* +*/ #define SQLITE_SESSION_OBJCONFIG_SIZE 1 /* @@ -356,11 +357,11 @@ int sqlite3session_changeset( /* ** CAPI3REF: Return An Upper-limit For The Size Of The Changeset -** METHOD: sqlite3session_changeset_size() +** METHOD: sqlite3_session ** ** By default, this function always returns 0. For it to return ** a useful result, the sqlite3_session object must have been configured -** to enable this API using [sqlite3session_object_config()] with the +** to enable this API using sqlite3session_object_config() with the ** SQLITE_SESSION_OBJCONFIG_SIZE verb. ** ** When enabled, this function returns an upper limit, in bytes, for the size diff --git a/manifest b/manifest index 157d4a535b..da535f89fb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\soperation\sof\sthe\s"-"\sargument\sto\s--load-dbsql\sin\sthe\sfuzzcheck\sprogram. -D 2021-04-29T18:03:42.662 +C Reduce\sAPI\slifetime\srequirement\sfor\sobjects\spassed\sto\ssqlite3_bind_...()\swith\sSQLITE_STATIC.\nAlso\sfix\sbroken\ssession\sdoc\slinks\s(by\szapping\srefs.) +D 2021-04-29T19:30:35.687 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -457,7 +457,7 @@ F ext/session/sessionsize.test 6f644aff31c7f1e4871e9ff3542766e18da68fc7e587b83a3 F ext/session/sessionstat1.test 218d351cf9fcd6648f125a26b607b140310160184723c2666091b54450a68fb5 F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc F ext/session/sqlite3session.c 703634ca25b4b903ae8ec25045802a8c8deca36a65d2b993c4bc8888f6d6c7ee -F ext/session/sqlite3session.h 4c299467627cd27ac31fcbd062274da676d0c471be22f1255867f30f4f832b9a +F ext/session/sqlite3session.h 0907de79bc13a2e3af30a6dc29acc60792a3eaf7d33d44cf52500d0f3c2b2171 F ext/session/test_session.c f433f68a8a8c64b0f5bc74dc725078f12483301ad4ae8375205eef790274a787 F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 @@ -545,7 +545,7 @@ F src/resolve.c c38bbb89d7ba7a8673ec4f59b63e0980eb859c39ff2acc5df8b3d0f2dcd33115 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/select.c 57dbb27e0d0cb2438487c797365a4c17294d0df3c25c970ca87f123105f33ed0 F src/shell.c.in 9320b476fde0f7c46700e5695b69b435f1e46843a1513cdd187ac426cdbee016 -F src/sqlite.h.in 372554fcd1e1ed25ba44a316e8abdaad712470b7dcfa185ece54f51b10fbde10 +F src/sqlite.h.in 325474dd22536800a5ffe9da4c12f753086a5b75aa8ecb22b3eb89b96003c3f6 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 61b38c073d5e1e96a3d45271b257aef27d0d13da2bea5347692ae579475cd95e F src/sqliteInt.h a00cc0642e2a4e26367313dc553781253e278a0e571e7211cc56245a8db3e0e7 @@ -1914,7 +1914,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P eb40248ce606b792a02e4e0b7dd826a82891c5f4c9793f3ca5d332e593109525 -R d43ef4a20157a0eacec2793f290bf114 -U drh -Z a90baec8909dfb2492fec48bd614d8da +P 1f18b3cbee7e1342fdd66e45ef744fea3db2ba4513943c0582ff8ef98974865e +R a78d350c59fe6553720f9550ece78cd1 +U larrybr +Z 074c9b08e89236747ec4bf43138da321 diff --git a/manifest.uuid b/manifest.uuid index c256a87cc1..4330198048 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1f18b3cbee7e1342fdd66e45ef744fea3db2ba4513943c0582ff8ef98974865e \ No newline at end of file +327eb4792f9b98f6220fd35ba744002d36ed53f43a016924117b3cea32343947 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 56f23f2b08..5ed2cbf099 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4363,18 +4363,22 @@ typedef struct sqlite3_context sqlite3_context; ** contain embedded NULs. The result of expressions involving strings ** with embedded NULs is undefined. ** -** ^The fifth argument to the BLOB and string binding interfaces -** is a destructor used to dispose of the BLOB or -** string after SQLite has finished with it. ^The destructor is called -** to dispose of the BLOB or string even if the call to the bind API fails, -** except the destructor is not called if the third parameter is a NULL -** pointer or the fourth parameter is negative. -** ^If the fifth argument is -** the special value [SQLITE_STATIC], then SQLite assumes that the -** information is in static, unmanaged space and does not need to be freed. -** ^If the fifth argument has the value [SQLITE_TRANSIENT], then -** SQLite makes its own private copy of the data immediately, before -** the sqlite3_bind_*() routine returns. +** ^The fifth argument to the BLOB and string binding interfaces controls +** or indicates the lifetime of the object referenced by the third parameter. +** ^These three options exist: +** ^(1) A destructor to dispose of the BLOB or string after SQLite has finished +** with it may be passed. ^It is called to dispose of the BLOB or string even +** if the call to the bind API fails, except the destructor is not called if +** the third parameter is a NULL pointer or the fourth parameter is negative. +** ^(2) The special constant, [SQLITE_STATIC], may be passsed to indicate that +** the application remains responsible for disposing of the object. ^In this +** case, the object and the provided pointer to it must remain valid until +** either the prepared statement is finalized or the same SQL parameter is +** bound to something else, whichever occurs sooner. +** ^(3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the +** object is to be copied prior to the return from sqlite3_bind_*(). ^The +** object and pointer to it must remain valid until then. ^SQLite will then +** manage the lifetime of its private copy. ** ** ^The sixth argument to sqlite3_bind_text64() must be one of ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]