1 Star 0 Fork 39

ethan848/sqlite

forked from src-openEuler/sqlite 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
6004-Fix-a-minor-problem-in-the-code-for-determining-whet.patch 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 11:17 . Package init
From 9627c47a03bfa5aa59fa59b1ef37d8fa524fd9f2 Mon Sep 17 00:00:00 2001
From: Dan Kennedy <danielk1977@gmail.com>
Date: Sat, 30 Jun 2018 20:00:35 +0000
Subject: [PATCH 0121/1009] Fix a minor problem in the code for determining
whether or not an SQL statement is SQLITE_TOOBIG.
From https://github.com/mackyle/sqlite/commit/9627c47a03bfa5aa59fa59b1ef37d8fa524fd9f2
---
src/alter.c | 4 ++--
src/tokenize.c | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/alter.c b/src/alter.c
index f338e8b..2d7a5d6 100644
--- a/src/alter.c
+++ b/src/alter.c
@@ -74,7 +74,7 @@ static void renameTableFunc(
zCsr += len;
len = sqlite3GetToken(zCsr, &token);
} while( token==TK_SPACE );
- assert( len>0 );
+ assert( len>0 || !*zCsr );
} while( token!=TK_LP && token!=TK_USING );
zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql),
@@ -198,7 +198,7 @@ static void renameTriggerFunc(
zCsr += len;
len = sqlite3GetToken(zCsr, &token);
}while( token==TK_SPACE );
- assert( len>0 );
+ assert( len>0 || !*zCsr );
/* Variable 'dist' stores the number of tokens read since the most
** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN
diff --git a/src/tokenize.c b/src/tokenize.c
index 15678ed..fc5989c 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -54,11 +54,12 @@
#define CC_TILDA 25 /* '~' */
#define CC_DOT 26 /* '.' */
#define CC_ILLEGAL 27 /* Illegal character */
+#define CC_NUL 28 /* 0x00 */
static const unsigned char aiClass[] = {
#ifdef SQLITE_ASCII
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
-/* 0x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 7, 7, 27, 7, 7, 27, 27,
+/* 0x */ 28, 27, 27, 27, 27, 27, 27, 27, 27, 7, 7, 27, 7, 7, 27, 27,
/* 1x */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
/* 2x */ 7, 15, 8, 5, 4, 22, 24, 8, 17, 18, 21, 20, 23, 11, 26, 16,
/* 3x */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 12, 14, 13, 6,
@@ -532,6 +533,10 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
i = 1;
break;
}
+ case CC_NUL: {
+ *tokenType = TK_ILLEGAL;
+ return 0;
+ }
default: {
*tokenType = TK_ILLEGAL;
return 1;
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ethan848/sqlite.git
git@gitee.com:ethan848/sqlite.git
ethan848
sqlite
sqlite
master

搜索帮助