提交 07b5c9c9 编写于 作者: G Ganlin Zhao

[TD-6356]<fix>: Fix the crash in TS-187

上级 7c76e859
......@@ -3474,19 +3474,19 @@ void filterPrepare(void* expr, void* param) {
if (pInfo->optr == TSDB_RELATION_IN) {
int dummy = -1;
SHashObj *pObj = NULL;
SHashObj *pObj = NULL;
if (pInfo->sch.colId == TSDB_TBNAME_COLUMN_INDEX) {
pObj = taosHashInit(256, taosGetDefaultHashFunction(pInfo->sch.type), true, false);
SArray *arr = (SArray *)(pCond->arr);
for (size_t i = 0; i < taosArrayGetSize(arr); i++) {
char* p = taosArrayGetP(arr, i);
strtolower(varDataVal(p), varDataVal(p));
taosHashPut(pObj, varDataVal(p),varDataLen(p), &dummy, sizeof(dummy));
strntolower_s(varDataVal(p), varDataVal(p), varDataLen(p));
taosHashPut(pObj, varDataVal(p), varDataLen(p), &dummy, sizeof(dummy));
}
} else {
buildFilterSetFromBinary((void **)&pObj, pCond->pz, pCond->nLen);
}
pInfo->q = (char *)pObj;
pInfo->q = (char *)pObj;
} else if (pCond != NULL) {
uint32_t size = pCond->nLen * TSDB_NCHAR_SIZE;
if (size < (uint32_t)pSchema->bytes) {
......
......@@ -32,6 +32,7 @@ char * strnchr(char *haystack, char needle, int32_t len, bool skipquote);
char ** strsplit(char *src, const char *delim, int32_t *num);
char * strtolower(char *dst, const char *src);
char * strntolower(char *dst, const char *src, int32_t n);
char * strntolower_s(char *dst, const char *src, int32_t n);
int64_t strnatoi(char *num, int32_t len);
char * strbetween(char *string, char *begin, char *end);
char * paGetToken(char *src, char **token, int32_t *tokenLen);
......
......@@ -200,7 +200,7 @@ char* strntolower(char *dst, const char *src, int32_t n) {
if (n == 0) {
*p = 0;
return dst;
}
}
for (c = *src++; n-- > 0; c = *src++) {
if (esc) {
esc = 0;
......@@ -222,6 +222,27 @@ char* strntolower(char *dst, const char *src, int32_t n) {
return dst;
}
char* strntolower_s(char *dst, const char *src, int32_t n) {
char *p = dst, c;
assert(dst != NULL);
if (n == 0) {
*p = 0;
return dst;
}
while (n-- > 0) {
c = *src;
if (c >= 'A' && c <= 'Z') {
c -= 'A' - 'a';
}
*p++ = c;
src++;
}
return dst;
}
char *paGetToken(char *string, char **token, int32_t *tokenLen) {
char quote = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册