Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e0dbe221
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e0dbe221
编写于
1月 11, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix uninitialized memory buffer accessed.
上级
75f4e643
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
13 deletion
+25
-13
include/common/tdatablock.h
include/common/tdatablock.h
+8
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+2
-2
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+0
-1
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+7
-0
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+8
-9
未找到文件。
include/common/tdatablock.h
浏览文件 @
e0dbe221
...
...
@@ -41,6 +41,12 @@ typedef struct SBlockOrderInfo {
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
} while (0)
#define colDataSetNull_f_s(c_, r_) \
do { \
colDataSetNull_f((c_)->nullbitmap, r_); \
memset(((char*)(c_)->pData) + (c_)->info.bytes * (r_), 0, (c_)->info.bytes); \
} while (0)
#define colDataClearNull_f(bm_, r_) \
do { \
BMCharPos(bm_, r_) &= ((char)(~(1u << (7u - BitPos(r_))))); \
...
...
@@ -136,7 +142,7 @@ static FORCE_INLINE void colDataAppendNULL(SColumnInfoData* pColumnInfoData, uin
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
colDataSetNull_var
(
pColumnInfoData
,
currentRow
);
// it is a null value of VAR type.
}
else
{
colDataSetNull_f
(
pColumnInfoData
->
nullbitmap
,
currentRow
);
colDataSetNull_f
_s
(
pColumnInfoData
,
currentRow
);
}
pColumnInfoData
->
hasNull
=
true
;
...
...
@@ -151,6 +157,7 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
colDataSetNull_f
(
pColumnInfoData
->
nullbitmap
,
i
);
}
memset
(
pColumnInfoData
->
pData
+
start
*
pColumnInfoData
->
info
.
bytes
,
0
,
pColumnInfoData
->
info
.
bytes
*
nRows
);
}
pColumnInfoData
->
hasNull
=
true
;
...
...
source/common/src/tdatablock.c
浏览文件 @
e0dbe221
...
...
@@ -69,7 +69,7 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
pColumnInfoData
->
varmeta
.
offset
[
currentRow
]
=
-
1
;
// it is a null value of VAR type.
}
else
{
colDataSetNull_f
(
pColumnInfoData
->
nullbitmap
,
currentRow
);
colDataSetNull_f
_s
(
pColumnInfoData
,
currentRow
);
}
pColumnInfoData
->
hasNull
=
true
;
...
...
@@ -825,7 +825,7 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB
}
else
{
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
rows
;
++
j
)
{
if
(
colDataIsNull_f
(
pSrc
->
nullbitmap
,
index
[
j
]))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
j
);
colDataSetNull_f
_s
(
pDst
,
j
);
continue
;
}
memcpy
(
pDst
->
pData
+
j
*
pDst
->
info
.
bytes
,
pSrc
->
pData
+
index
[
j
]
*
pDst
->
info
.
bytes
,
pDst
->
info
.
bytes
);
...
...
source/libs/executor/src/projectoperator.c
浏览文件 @
e0dbe221
...
...
@@ -279,7 +279,6 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
// for stream interval
if
(
pBlock
->
info
.
type
==
STREAM_RETRIEVE
||
pBlock
->
info
.
type
==
STREAM_DELETE_RESULT
||
pBlock
->
info
.
type
==
STREAM_DELETE_DATA
)
{
// printDataBlock1(pBlock, "project1");
return
pBlock
;
}
...
...
source/libs/executor/src/sysscanoperator.c
浏览文件 @
e0dbe221
...
...
@@ -1918,6 +1918,13 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator) {
colDataAppend
(
pColInfo
,
0
,
p
,
false
);
taosMemoryFree
(
p
);
// make the valgrind happy that all memory buffer has been initialized already.
if
(
slotId
!=
0
)
{
SColumnInfoData
*
p1
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
int64_t
v
=
0
;
colDataAppendInt64
(
p1
,
0
,
&
v
);
}
pBlock
->
info
.
rows
=
1
;
pOperator
->
status
=
OP_EXEC_DONE
;
return
pBlock
;
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
e0dbe221
...
...
@@ -2645,7 +2645,7 @@ static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
int32_t
v
=
*
(
int32_t
*
)
pv
;
int64_t
delta
=
factor
*
(
v
-
pDiffInfo
->
prev
.
i64
);
// direct previous may be null
if
(
delta
<
0
&&
pDiffInfo
->
ignoreNegative
)
{
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
}
else
{
colDataAppendInt64
(
pOutput
,
pos
,
&
delta
);
}
...
...
@@ -2658,7 +2658,7 @@ static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
int8_t
v
=
*
(
int8_t
*
)
pv
;
int64_t
delta
=
factor
*
(
v
-
pDiffInfo
->
prev
.
i64
);
// direct previous may be null
if
(
delta
<
0
&&
pDiffInfo
->
ignoreNegative
)
{
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
}
else
{
colDataAppendInt64
(
pOutput
,
pos
,
&
delta
);
}
...
...
@@ -2669,7 +2669,7 @@ static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
int16_t
v
=
*
(
int16_t
*
)
pv
;
int64_t
delta
=
factor
*
(
v
-
pDiffInfo
->
prev
.
i64
);
// direct previous may be null
if
(
delta
<
0
&&
pDiffInfo
->
ignoreNegative
)
{
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
}
else
{
colDataAppendInt64
(
pOutput
,
pos
,
&
delta
);
}
...
...
@@ -2681,7 +2681,7 @@ static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
int64_t
v
=
*
(
int64_t
*
)
pv
;
int64_t
delta
=
factor
*
(
v
-
pDiffInfo
->
prev
.
i64
);
// direct previous may be null
if
(
delta
<
0
&&
pDiffInfo
->
ignoreNegative
)
{
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
}
else
{
colDataAppendInt64
(
pOutput
,
pos
,
&
delta
);
}
...
...
@@ -2692,7 +2692,7 @@ static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
float
v
=
*
(
float
*
)
pv
;
double
delta
=
factor
*
(
v
-
pDiffInfo
->
prev
.
d64
);
// direct previous may be null
if
((
delta
<
0
&&
pDiffInfo
->
ignoreNegative
)
||
isinf
(
delta
)
||
isnan
(
delta
))
{
// check for overflow
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
}
else
{
colDataAppendDouble
(
pOutput
,
pos
,
&
delta
);
}
...
...
@@ -2703,7 +2703,7 @@ static int32_t doHandleDiff(SDiffInfo* pDiffInfo, int32_t type, const char* pv,
double
v
=
*
(
double
*
)
pv
;
double
delta
=
factor
*
(
v
-
pDiffInfo
->
prev
.
d64
);
// direct previous may be null
if
((
delta
<
0
&&
pDiffInfo
->
ignoreNegative
)
||
isinf
(
delta
)
||
isnan
(
delta
))
{
// check for overflow
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
}
else
{
colDataAppendDouble
(
pOutput
,
pos
,
&
delta
);
}
...
...
@@ -2738,7 +2738,7 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) {
if
(
colDataIsNull_f
(
pInputCol
->
nullbitmap
,
i
))
{
if
(
pDiffInfo
->
includeNull
)
{
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f
_s
(
pOutput
,
pos
);
numOfElems
+=
1
;
}
...
...
@@ -2776,8 +2776,7 @@ int32_t diffFunction(SqlFunctionCtx* pCtx) {
if
(
colDataIsNull_f
(
pInputCol
->
nullbitmap
,
i
))
{
if
(
pDiffInfo
->
includeNull
)
{
colDataSetNull_f
(
pOutput
->
nullbitmap
,
pos
);
colDataSetNull_f_s
(
pOutput
,
pos
);
numOfElems
+=
1
;
}
continue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录