aboutsummaryrefslogtreecommitdiff
path: root/src/func.c
diff options
context:
space:
mode:
authordrh <>2021-10-12 22:55:04 +0000
committerdrh <>2021-10-12 22:55:04 +0000
commit4fc80671f53f016d513bcb31b03e759b031d42bc (patch)
tree209efb903f3114a483fdb80755ac5a880cc22e32 /src/func.c
parentffa5b054ddbdffd93d6d1215a8eddffc6a40398d (diff)
downloadsqlite-4fc80671f53f016d513bcb31b03e759b031d42bc.tar.gz
sqlite-4fc80671f53f016d513bcb31b03e759b031d42bc.zip
Fix the group_concat() inverse function implementation so that it correctly
handles BLOB inputs when database text encoding is UTF16. FossilOrigin-Name: 38a1326b4bd11bbe2846990d099c28520d17ab4cace1af67248c2472f89df929
Diffstat (limited to 'src/func.c')
-rw-r--r--src/func.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/func.c b/src/func.c
index 208da48e2..6a2903d32 100644
--- a/src/func.c
+++ b/src/func.c
@@ -1820,7 +1820,11 @@ static void groupConcatInverse(
/* pGCC is always non-NULL since groupConcatStep() will have always
** run frist to initialize it */
if( ALWAYS(pGCC) ){
- int nVS = sqlite3_value_bytes(argv[0]);
+ int nVS;
+ /* Must call sqlite3_value_text() to convert the argument into text prior
+ ** to invoking sqlite3_value_bytes(), in case the text encoding is UTF16 */
+ (void)sqlite3_value_text(argv[0]);
+ nVS = sqlite3_value_bytes(argv[0]);
pGCC->nAccum -= 1;
if( pGCC->pnSepLengths!=0 ){
assert(pGCC->nAccum >= 0);