fix parser stack overflow issue

This commit is contained in:
dapan1121 2022-06-01 14:39:40 +08:00
parent f5ce8c9df8
commit 6aece12755
3 changed files with 976 additions and 528 deletions

View File

@ -15,11 +15,15 @@
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#define ALLOW_FORBID_FUNC
#include "functionMgt.h" #include "functionMgt.h"
#include "nodes.h" #include "nodes.h"
#include "parToken.h" #include "parToken.h"
#include "ttokendef.h" #include "ttokendef.h"
#include "parAst.h" #include "parAst.h"
#define YYSTACKDEPTH 0
} }
%syntax_error { %syntax_error {

View File

@ -76,28 +76,8 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) {
int32_t inputSize = (NULL != pParam->length ? *(pParam->length) : tDataTypes[pParam->buffer_type].bytes); int32_t inputSize = (NULL != pParam->length ? *(pParam->length) : tDataTypes[pParam->buffer_type].bytes);
pVal->node.resType.type = pParam->buffer_type; pVal->node.resType.type = pParam->buffer_type;
pVal->node.resType.bytes = inputSize; pVal->node.resType.bytes = inputSize;
switch (pParam->buffer_type) { switch (pParam->buffer_type) {
case TSDB_DATA_TYPE_BOOL:
pVal->datum.b = *((bool*)pParam->buffer);
break;
case TSDB_DATA_TYPE_TINYINT:
pVal->datum.i = *((int8_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_SMALLINT:
pVal->datum.i = *((int16_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_INT:
pVal->datum.i = *((int32_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_BIGINT:
pVal->datum.i = *((int64_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_FLOAT:
pVal->datum.d = *((float*)pParam->buffer);
break;
case TSDB_DATA_TYPE_DOUBLE:
pVal->datum.d = *((double*)pParam->buffer);
break;
case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARCHAR:
case TSDB_DATA_TYPE_VARBINARY: case TSDB_DATA_TYPE_VARBINARY:
pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1); pVal->datum.p = taosMemoryCalloc(1, pVal->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
@ -124,28 +104,13 @@ static int32_t setValueByBindParam(SValueNode* pVal, TAOS_MULTI_BIND* pParam) {
pVal->node.resType.bytes = output + VARSTR_HEADER_SIZE; pVal->node.resType.bytes = output + VARSTR_HEADER_SIZE;
break; break;
} }
case TSDB_DATA_TYPE_TIMESTAMP: default: {
pVal->datum.i = *((int64_t*)pParam->buffer); int32_t code = nodesSetValueNodeValue(pVal, pParam->buffer);
break; if (code) {
case TSDB_DATA_TYPE_UTINYINT: return code;
pVal->datum.u = *((uint8_t*)pParam->buffer); }
break;
case TSDB_DATA_TYPE_USMALLINT:
pVal->datum.u = *((uint16_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_UINT:
pVal->datum.u = *((uint32_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_UBIGINT:
pVal->datum.u = *((uint64_t*)pParam->buffer);
break;
case TSDB_DATA_TYPE_JSON:
case TSDB_DATA_TYPE_DECIMAL:
case TSDB_DATA_TYPE_BLOB:
case TSDB_DATA_TYPE_MEDIUMBLOB:
// todo
default:
break; break;
}
} }
pVal->translate = true; pVal->translate = true;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;

File diff suppressed because it is too large Load Diff