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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ace88ca2
Commit
ace88ca2
authored
Mar 15, 2011
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
4f786b3e
7a37a7c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
mysql-test/r/cast.result
mysql-test/r/cast.result
+15
-0
mysql-test/t/cast.test
mysql-test/t/cast.test
+14
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+13
-0
No files found.
mysql-test/r/cast.result
View file @
ace88ca2
...
@@ -451,4 +451,19 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
...
@@ -451,4 +451,19 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
1
1
1
1
DROP TABLE t1;
DROP TABLE t1;
#
# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
# DOESN'T ADHERE TO MAX_ALLOWED_PACKET
SET @@GLOBAL.max_allowed_packet=2048;
SELECT CONVERT('a', BINARY(2049));
CONVERT('a', BINARY(2049))
NULL
Warnings:
Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (2048) - truncated
SELECT CONVERT('a', CHAR(2049));
CONVERT('a', CHAR(2049))
NULL
Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
SET @@GLOBAL.max_allowed_packet=default;
End of 5.1 tests
End of 5.1 tests
mysql-test/t/cast.test
View file @
ace88ca2
...
@@ -280,5 +280,19 @@ SELECT 1 FROM
...
@@ -280,5 +280,19 @@ SELECT 1 FROM
)
AS
s
LIMIT
1
;
)
AS
s
LIMIT
1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
--
echo
# DOESN'T ADHERE TO MAX_ALLOWED_PACKET
SET
@@
GLOBAL
.
max_allowed_packet
=
2048
;
# reconnect to make the new max packet size take effect
--
connect
(
newconn
,
localhost
,
root
,,)
SELECT
CONVERT
(
'a'
,
BINARY
(
2049
));
SELECT
CONVERT
(
'a'
,
CHAR
(
2049
));
connection
default
;
disconnect
newconn
;
SET
@@
GLOBAL
.
max_allowed_packet
=
default
;
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
sql/item_timefunc.cc
View file @
ace88ca2
...
@@ -2524,6 +2524,19 @@ String *Item_char_typecast::val_str(String *str)
...
@@ -2524,6 +2524,19 @@ String *Item_char_typecast::val_str(String *str)
String
*
res
;
String
*
res
;
uint32
length
;
uint32
length
;
if
(
cast_length
>=
0
&&
((
unsigned
)
cast_length
)
>
current_thd
->
variables
.
max_allowed_packet
)
{
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_ALLOWED_PACKET_OVERFLOWED
,
ER
(
ER_WARN_ALLOWED_PACKET_OVERFLOWED
),
cast_cs
==
&
my_charset_bin
?
"cast_as_binary"
:
func_name
(),
current_thd
->
variables
.
max_allowed_packet
);
null_value
=
1
;
return
0
;
}
if
(
!
charset_conversion
)
if
(
!
charset_conversion
)
{
{
if
(
!
(
res
=
args
[
0
]
->
val_str
(
str
)))
if
(
!
(
res
=
args
[
0
]
->
val_str
(
str
)))
...
...
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