Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
eca15790
Commit
eca15790
authored
Dec 03, 2016
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-11444 Server crashes in String::ptr / Item_func_json_depth::val_int.
CAST AS JSON didn't set the null_value mark properly.
parent
4ad0813a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
5 deletions
+13
-5
mysql-test/r/func_json.result
mysql-test/r/func_json.result
+3
-0
mysql-test/t/func_json.test
mysql-test/t/func_json.test
+2
-0
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+7
-0
sql/item_jsonfunc.h
sql/item_jsonfunc.h
+1
-5
No files found.
mysql-test/r/func_json.result
View file @
eca15790
...
...
@@ -223,3 +223,6 @@ json_object("a", '{"b": "abcd"}')
select json_object("a", cast('{"b": "abcd"}' as json));
json_object("a", cast('{"b": "abcd"}' as json))
{"a": {"b": "abcd"}}
select json_depth(cast(NULL as JSON));
json_depth(cast(NULL as JSON))
NULL
mysql-test/t/func_json.test
View file @
eca15790
...
...
@@ -98,3 +98,5 @@ select json_object("a", json_object("b", "abcd"));
select
json_object
(
"a"
,
'{"b": "abcd"}'
);
select
json_object
(
"a"
,
cast
(
'{"b": "abcd"}'
as
json
));
select
json_depth
(
cast
(
NULL
as
JSON
));
sql/item_jsonfunc.cc
View file @
eca15790
...
...
@@ -2073,3 +2073,10 @@ void Item_json_typecast::fix_length_and_dec()
}
String
*
Item_json_typecast
::
val_str
(
String
*
str
)
{
String
*
vs
=
args
[
0
]
->
val_str
(
str
);
null_value
=
args
[
0
]
->
null_value
;
return
vs
;
}
sql/item_jsonfunc.h
View file @
eca15790
...
...
@@ -420,11 +420,7 @@ class Item_json_typecast: public Item_str_func
const
char
*
func_name
()
const
{
return
"cast_as_json"
;
}
bool
is_json_type
()
{
return
true
;
}
void
fix_length_and_dec
();
String
*
val_str
(
String
*
str
)
{
return
args
[
0
]
->
val_str
(
str
);
}
String
*
val_str
(
String
*
str
);
Item
*
get_copy
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
{
return
get_item_copy
<
Item_json_typecast
>
(
thd
,
mem_root
,
this
);
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment