diff options
author | unknown <cmiller@zippy.(none)> | 2006-07-11 13:06:29 -0400 |
---|---|---|
committer | unknown <cmiller@zippy.(none)> | 2006-07-11 13:06:29 -0400 |
commit | ed001f18a49301f51cab3e3e5d5c9ade212bd19f (patch) | |
tree | efc83f492c0f549dba2db98ebbc02e7da5e517a5 /mysql-test/t/date_formats.test | |
parent | 17986f7cae70ce27ef8a43b4403dbf203c3ef277 (diff) | |
download | mariadb-git-ed001f18a49301f51cab3e3e5d5c9ade212bd19f.tar.gz |
Bug#20729: Bad date_format() call makes mysql server crash
The problem is that the author used the wrong function to send a warning to the
user about truncation of data. push_warning() takes a constant string and
push_warning_printf() takes a format and variable arguments to fill it.
Since the string we were complaining about contains percent characters, the
printf() code interprets the "%Y" et c. that the user sends. That's wrong, and
often causes a crash, especially if the date mentions seconds, "%s".
A alternate fix would be to use push_warning_printf(..., "%s", warn_buff) .
mysql-test/r/date_formats.result:
Test that an invalid date doesn't crash the server. We should get a warning back
instead of a dead socket.
mysql-test/t/date_formats.test:
Test that an invalid date doesn't crash the server. We should get a warning back
instead of a dead socket.
sql/time.cc:
Don't try to use warn_buf as the start of a varible arguement list to send
to a warning-formatted my_vsnprintf() .
Diffstat (limited to 'mysql-test/t/date_formats.test')
-rw-r--r-- | mysql-test/t/date_formats.test | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index f3d507e69e6..0c227258383 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -275,7 +275,6 @@ drop table t1; select str_to_date( 1, NULL ); select str_to_date( NULL, 1 ); select str_to_date( 1, IF(1=1,NULL,NULL) ); -# End of 4.1 tests # # Bug#11326 @@ -298,3 +297,10 @@ SELECT TIME_FORMAT("12:00:00", '%l %p'); SELECT TIME_FORMAT("23:00:00", '%l %p'); SELECT TIME_FORMAT("24:00:00", '%l %p'); SELECT TIME_FORMAT("25:00:00", '%l %p'); + +# +# Bug#20729: Bad date_format() call makes mysql server crash +# +SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896); + +--echo "End of 4.1 tests" |