/ Check-in [1a1a59c6]
Login

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

Overview
Comment:Fix a missing mutex in the sqlite3_normalized_sql() interface when it is called on a prepared statement that did not previously have a computed normalization of the input SQL.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1a1a59c6c570879c8f318bbc132103c0285088ba233dd8c32e049b86419347b0
User & Date: drh 2018-12-06 01:08:58
Context
2018-12-06
01:53
Fix a potential NULL pointer dereference that can occur in ALTER TABLE following an OOM. Test case in TH3. check-in: ea50815b user: drh tags: trunk
01:08
Fix a missing mutex in the sqlite3_normalized_sql() interface when it is called on a prepared statement that did not previously have a computed normalization of the input SQL. check-in: 1a1a59c6 user: drh tags: trunk
2018-12-05
23:56
Get rid of the hash table used to track IN operators in the sqlite3_normalized_sql() implementation. Use simple integer variables instead. check-in: 272dc74f user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

1710
1711
1712
1713
1714
1715
1716

1717

1718
1719
1720
1721
1722
1723
1724
/*
** Return the normalized SQL associated with a prepared statement.
*/
const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe *)pStmt;
  if( p==0 ) return 0;
  if( p->zNormSql==0 && p->zSql!=0 ){

    p->zNormSql = sqlite3Normalize(p, p->zSql, sqlite3Strlen30(p->zSql));

  }
  return p->zNormSql;
}
#endif /* SQLITE_ENABLE_NORMALIZE */

#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
/*







>

>







1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
/*
** Return the normalized SQL associated with a prepared statement.
*/
const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe *)pStmt;
  if( p==0 ) return 0;
  if( p->zNormSql==0 && p->zSql!=0 ){
    sqlite3_mutex_enter(p->db->mutex);
    p->zNormSql = sqlite3Normalize(p, p->zSql, sqlite3Strlen30(p->zSql));
    sqlite3_mutex_leave(p->db->mutex);
  }
  return p->zNormSql;
}
#endif /* SQLITE_ENABLE_NORMALIZE */

#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
/*