aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/shathree.c
diff options
context:
space:
mode:
authordrh <>2021-01-19 20:38:13 +0000
committerdrh <>2021-01-19 20:38:13 +0000
commitb08dbd0f28db45dbf2a6ef7d7ab76d415b30f2f3 (patch)
tree3034941369fb0d74c961acf7a12e7932db0cfb62 /ext/misc/shathree.c
parent00a0b135ecc6129260a0ca1d1ee951173dfb1c48 (diff)
downloadsqlite-b08dbd0f28db45dbf2a6ef7d7ab76d415b30f2f3.tar.gz
sqlite-b08dbd0f28db45dbf2a6ef7d7ab76d415b30f2f3.zip
Fix an issue with sha3_query() when the first argument contains blank
SQL statements. FossilOrigin-Name: a1a7a5f238fcfdcd56faba063e381258c9e2944d9b02b31d402a4207a607fc1c
Diffstat (limited to 'ext/misc/shathree.c')
-rw-r--r--ext/misc/shathree.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/misc/shathree.c b/ext/misc/shathree.c
index 56eba564c..56a5584f3 100644
--- a/ext/misc/shathree.c
+++ b/ext/misc/shathree.c
@@ -621,9 +621,11 @@ static void sha3QueryFunc(
}
nCol = sqlite3_column_count(pStmt);
z = sqlite3_sql(pStmt);
- n = (int)strlen(z);
- hash_step_vformat(&cx,"S%d:",n);
- SHA3Update(&cx,(unsigned char*)z,n);
+ if( z ){
+ n = (int)strlen(z);
+ hash_step_vformat(&cx,"S%d:",n);
+ SHA3Update(&cx,(unsigned char*)z,n);
+ }
/* Compute a hash over the result of the query */
while( SQLITE_ROW==sqlite3_step(pStmt) ){