!4259 修复json嵌套层数过深导致爆栈的core问题
Merge pull request !4259 from pengjiong/fix_ci
This commit is contained in:
@ -394,6 +394,8 @@ static void parse_object(JsonLexContext *lex, JsonSemAction *sem)
|
||||
json_struct_action oend = sem->object_end;
|
||||
JsonTokenType tok;
|
||||
|
||||
check_stack_depth();
|
||||
|
||||
if (ostart != NULL) {
|
||||
(*ostart) (sem->semstate);
|
||||
}
|
||||
@ -469,6 +471,8 @@ static void parse_array(JsonLexContext *lex, JsonSemAction *sem)
|
||||
json_struct_action astart = sem->array_start;
|
||||
json_struct_action aend = sem->array_end;
|
||||
|
||||
check_stack_depth();
|
||||
|
||||
if (astart != NULL) {
|
||||
(*astart) (sem->semstate);
|
||||
}
|
||||
|
||||
@ -1214,6 +1214,11 @@ CONTEXT: referenced column: json_object
|
||||
select json_object('{a,b,"","d e f"}','{1,2,3,"a b c"}');
|
||||
ERROR: empty value not allowed for object key
|
||||
CONTEXT: referenced column: json_object
|
||||
-- execced max stack depath
|
||||
select json_in(REPEAT('{"a":[', 100000)::cstring);
|
||||
ERROR: stack depth limit exceeded
|
||||
HINT: Increase the configuration parameter "max_stack_depth" (currently 2048kB), after ensuring the platform's stack depth limit is adequate.
|
||||
CONTEXT: referenced column: json_in
|
||||
-- json_to_record and json_to_recordset
|
||||
select * from json_to_record('{"a":1,"b":"foo","c":"bar"}',true)
|
||||
as x(a int, b text, d text);
|
||||
|
||||
@ -418,6 +418,8 @@ select json_object('{a,b,NULL,"d e f"}','{1,2,3,"a b c"}');
|
||||
|
||||
select json_object('{a,b,"","d e f"}','{1,2,3,"a b c"}');
|
||||
|
||||
-- execced max stack depath
|
||||
select json_in(REPEAT('{"a":[', 100000)::cstring);
|
||||
|
||||
-- json_to_record and json_to_recordset
|
||||
|
||||
|
||||
Reference in New Issue
Block a user