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
4ad0813a
Commit
4ad0813a
authored
Dec 03, 2016
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-11143 Server crashes in json_string_set_cs.
Some JSON functions didn't expect NULL as a path.
parent
e8c41957
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
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
+1
-0
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+15
-0
No files found.
mysql-test/r/func_json.result
View file @
4ad0813a
...
...
@@ -91,6 +91,9 @@ json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2")
select json_contains_path('{ "a": true }', NULL, '$.a' );
json_contains_path('{ "a": true }', NULL, '$.a' )
NULL
select json_contains_path('{ "a": true }', 'all', NULL );
json_contains_path('{ "a": true }', 'all', NULL )
NULL
select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1")
"asd"
...
...
mysql-test/t/func_json.test
View file @
4ad0813a
...
...
@@ -36,6 +36,7 @@ select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
select
json_contains_path
(
'{"key1":1, "key2":[2,3]}'
,
"aLl"
,
"$.key1"
,
"$.ma"
);
select
json_contains_path
(
'{"key1":1, "key2":[2,3]}'
,
"aLl"
,
"$.key1"
,
"$.key2"
);
select
json_contains_path
(
'{ "a": true }'
,
NULL
,
'$.a'
);
select
json_contains_path
(
'{ "a": true }'
,
'all'
,
NULL
);
select
json_extract
(
'{"key1":"asd", "key2":[2,3]}'
,
"$.key1"
);
select
json_extract
(
'{"key1":"asd", "key2":[2,3]}'
,
"$.keyX"
,
"$.keyY"
);
...
...
sql/item_jsonfunc.cc
View file @
4ad0813a
...
...
@@ -450,6 +450,9 @@ String *Item_func_json_extract::val_str(String *str)
c_path
->
parsed
=
c_path
->
constant
;
}
if
(
args
[
n_arg
]
->
null_value
)
goto
error
;
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
...
...
@@ -547,6 +550,9 @@ longlong Item_func_json_extract::val_int()
c_path
->
parsed
=
c_path
->
constant
;
}
if
(
args
[
n_arg
]
->
null_value
)
goto
error
;
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
...
...
@@ -661,6 +667,9 @@ longlong Item_func_json_contains::val_int()
c_path
->
parsed
=
c_path
->
constant
;
}
if
(
args
[
n_arg
]
->
null_value
)
goto
error
;
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
...
...
@@ -768,6 +777,9 @@ longlong Item_func_json_contains_path::val_int()
c_path
->
parsed
=
c_path
->
constant
;
}
if
(
args
[
n_arg
]
->
null_value
)
goto
error
;
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
...
...
@@ -1946,6 +1958,9 @@ String *Item_func_json_search::val_str(String *str)
}
}
if
(
args
[
n_arg
]
->
null_value
)
goto
null_return
;
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
...
...
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