Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
daqiang163
TDengine
提交
b1dbab9a
T
TDengine
项目概览
daqiang163
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b1dbab9a
编写于
9月 26, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10423]<fix>: Wrong conversion when testing negative bigint
上级
d75acc51
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
8 deletion
+22
-8
deps/cJson/inc/cJSON.h
deps/cJson/inc/cJSON.h
+1
-1
deps/cJson/src/cJSON.c
deps/cJson/src/cJSON.c
+1
-1
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+20
-6
未找到文件。
deps/cJson/inc/cJSON.h
浏览文件 @
b1dbab9a
...
...
@@ -73,7 +73,7 @@ typedef struct cJSON
char
*
string
;
//Keep the original string of number
char
numberstring
[
13
];
char
numberstring
[
22
];
/* change this to 22 bytes to accommodate LLONG_MAX and LLONG_MINX*/
}
cJSON
;
typedef
struct
cJSON_Hooks
...
...
deps/cJson/src/cJSON.c
浏览文件 @
b1dbab9a
...
...
@@ -290,7 +290,7 @@ loop_end:
input_buffer
->
offset
+=
(
size_t
)(
after_end
-
number_c_string
);
strncpy
(
item
->
numberstring
,
(
const
char
*
)
number_c_string
,
12
);
strncpy
(
item
->
numberstring
,
(
const
char
*
)
number_c_string
,
strlen
((
const
char
*
)
number_c_string
)
);
return
true
;
}
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
b1dbab9a
...
...
@@ -623,14 +623,19 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
//bigint
if
(
strcasecmp
(
typeStr
,
"i64"
)
==
0
||
strcasecmp
(
typeStr
,
"bigint"
)
==
0
)
{
if
(
!
IS_VALID_BIGINT
(
value
->
valueint
))
{
tscError
(
"OTD:0x%"
PRIx64
" JSON value(%"
PRId64
") cannot fit in type(bigint)"
,
info
->
id
,
value
->
valueint
);
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_BIGINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
int64_t
*
)(
pVal
->
value
)
=
(
int64_t
)(
value
->
valueint
);
/* cJSON conversion of legit BIGINT may overflow,
* use original string to do the conversion.
*/
errno
=
0
;
int64_t
val
=
(
int64_t
)
strtoll
(
value
->
numberstring
,
NULL
,
10
);
if
(
errno
==
ERANGE
||
!
IS_VALID_BIGINT
(
val
))
{
tscError
(
"OTD:0x%"
PRIx64
" JSON value(%s) cannot fit in type(bigint)"
,
info
->
id
,
value
->
numberstring
);
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
*
(
int64_t
*
)(
pVal
->
value
)
=
val
;
return
TSDB_CODE_SUCCESS
;
}
//float
...
...
@@ -746,7 +751,16 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
pVal
->
type
=
TSDB_DATA_TYPE_BIGINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
int64_t
*
)(
pVal
->
value
)
=
(
int64_t
)(
root
->
valuedouble
);
/* cJSON conversion of legit BIGINT may overflow,
* use original string to do the conversion.
*/
errno
=
0
;
int64_t
val
=
(
int64_t
)
strtoll
(
root
->
numberstring
,
NULL
,
10
);
if
(
errno
==
ERANGE
||
!
IS_VALID_BIGINT
(
val
))
{
tscError
(
"OTD:0x%"
PRIx64
" JSON value(%s) cannot fit in type(bigint)"
,
info
->
id
,
root
->
numberstring
);
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
*
(
int64_t
*
)(
pVal
->
value
)
=
val
;
}
else
if
(
isValidFloat
(
root
->
numberstring
))
{
pVal
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录