Description:
If user asks the system to provide dayname for invalid
date it will give you some day name as long as day field is < = 31.
mysql> select dayname('1999-03-32');
+-----------------------+
| dayname('1999-03-32') |
+-----------------------+
| NULL |
+-----------------------+
1 row in set (0.00 sec)
mysql> select dayname('1999-02-32');
+-----------------------+
| dayname('1999-02-32') |
+-----------------------+
| NULL |
+-----------------------+
1 row in set (0.00 sec)
mysql> select dayname('1999-02-31');
+-----------------------+
| dayname('1999-02-31') |
+-----------------------+
| Wednesday |
+-----------------------+
1 row in set (0.00 sec)
//wrong should be NULL cuz feb has only 28 dayes
mysql> select dayname('1999-04-31');
+-----------------------+
| dayname('1999-04-31') |
+-----------------------+
| Saturday |
+-----------------------+
1 row in set (0.00 sec)
//wrong also should be NULL cuz apr has only 30 dayes
How-To-Repeat:
select dayname(yyyy-mm-(dd+more than month limit && <=31);
Fix:
Validation should be done in this function. Or it SHOULD be assumed
that all date we feed to mysql, should be considerred correct!!
Submitter-Id:Jahan ?
Originator: jahan
Organization:
J & J Software Solutions http://www.jjsoft.com
MySQL support: [none]
Synopsis: <synopsis of the problem (one line)>
Severity: [serious | critical ] if developers does not test the
function(s) at command prompt.
Priority: [ high ]
Category: mysql
Class: [ sw-bug ]
Release: mysql-3.21.33 (Source distribution)
Server: /usr/local/bin/mysqladmin Ver 6.9 Distrib 3.21.33b, for
unknown-freebsd3.0 on i386
TCX Datakonsult AB, by Monty
Server version 3.21.33b
Protocol version 10
Connection localhost via TCP/IP
TCP port 3306
Uptime: 4 hours 31 min 27 sec
Running threads: 3 Questions: 198 Opened_tables: 19 Flush tables: 2
Open tables: 8
Environment:
<machine, os, target, libraries (multiple lines)>
System: FreeBSD jjsoft2.com 3.1-STABLE FreeBSD 3.1-STABLE #5: Sat Apr 3
01:43:57 GMT 1999 root@stripped:/usr/src/sys/compile/JJSOFT2
i386
Some paths: /usr/bin/perl /usr/bin/make /usr/local/bin/gmake
/usr/bin/gcc /usr/bin/cc
GCC: gcc version 2.7.2.1
Compilation info: CC='gcc' CFLAGS='' CXX='gcc' CXXFLAGS=''
LDFLAGS=''
Configure command: --with-unix-socket-path=/var/tmp/mysql.sock
--with-low-memory --with-mit-threads=yes
Perl: This is perl, version 5.005_02 built for i386-freebsd