SQLite Forum

SQLITE_OMIT_AUTHORIZATION and unused result warning

SQLITE_OMIT_AUTHORIZATION and unused result warning

(1) By anonymous on 2021-04-29 16:38:06 [source]

If SQLITE_OMIT_AUTHORIZATION is defined, there's a MSVC warning "result of expression not used" in the latest source here:

    ** The fake column name is an empty string.  It is possible for a table to
    ** have a column named by the empty string, in which case there is no way to
    ** distinguish between an unreferenced table and an actual reference to the
    ** "" column. The original design was for the fake column name to be a NULL,
    ** which would be unambiguous.  But legacy authorization callbacks might
    ** assume the column name is non-NULL and segfault.  The use of an empty
    ** string for the fake column name seems safer.
    if( pItem->colUsed==0 && pItem->zName!=0 ){
      sqlite3AuthCheck(pParse, SQLITE_READ, pItem->zName, "", pItem->zDatabase);

It looks like the result of this function isn't checked in a few more places.

Shouldn't it be checked or explicitly cast to void if it's intentional?

(2) By Larry Brasfield (larrybr) on 2021-04-29 17:12:02 in reply to 1 [link] [source]

There will be many changes to the implementation within SQLITE_OMIT_AUTHORIZATION sections, to cure issues like this and some others. I anticipate these changes will appear in the next release.