From 56f7b46ae7601260359e978f56d98df8fa557a42 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 7 Jun 2022 17:49:51 +0800 Subject: [PATCH] fix:global buffer overflow --- include/util/tdef.h | 2 +- source/common/src/ttypes.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index ebfb7b696a..f6169af1aa 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -32,7 +32,7 @@ extern "C" { #define TD_VER_MAX UINT64_MAX // TODO: use the real max version from query handle // Bytes for each type. -extern const int32_t TYPE_BYTES[15]; +extern const int32_t TYPE_BYTES[16]; // TODO: replace and remove code below #define CHAR_BYTES sizeof(char) diff --git a/source/common/src/ttypes.c b/source/common/src/ttypes.c index b3999a49e7..156b66ae86 100644 --- a/source/common/src/ttypes.c +++ b/source/common/src/ttypes.c @@ -18,7 +18,7 @@ #include "tcompression.h" #include "trow.h" -const int32_t TYPE_BYTES[15] = { +const int32_t TYPE_BYTES[16] = { -1, // TSDB_DATA_TYPE_NULL CHAR_BYTES, // TSDB_DATA_TYPE_BOOL CHAR_BYTES, // TSDB_DATA_TYPE_TINYINT @@ -34,6 +34,7 @@ const int32_t TYPE_BYTES[15] = { SHORT_BYTES, // TSDB_DATA_TYPE_USMALLINT INT_BYTES, // TSDB_DATA_TYPE_UINT sizeof(uint64_t), // TSDB_DATA_TYPE_UBIGINT + TSDB_MAX_JSON_TAG_LEN, // TSDB_DATA_TYPE_JSON }; #define DO_STATICS(__sum, __min, __max, __minIndex, __maxIndex, _list, _index) \