Bug #47500 valgrind reports "invalid read" for the grant test
Submitted: 22 Sep 2009 0:14 Modified: 22 Sep 2009 14:29
Reporter: Mark Callaghan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version:5.0.84 OS:Any (CentOS 5This is )
Assigned to: CPU Architecture:Any
Tags: grant, invalid, read, test, valgrind

[22 Sep 2009 0:14] Mark Callaghan
Description:
This is listed in val/log/master.err when the grant test is run with other tests. The warning does not occur when grant is run in isolation:
CURRENT_TEST: grant
==5103== Thread 4:
==5103== Invalid read of size 1
==5103==    at 0x4C0249: MYSQLlex(void*, void*) (sql_lex.cc:678)
==5103==    by 0x577300: MYSQLparse(void*) (sql_yacc.cc:14653)
==5103==    by 0x573389: mysql_parse(THD*, char const*, unsigned, char const**) (sql_parse.cc:6402)
==5103==    by 0x574030: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1961)
==5103==    by 0x575B46: handle_one_connection (sql_parse.cc:1642)
==5103==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==5103==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)
==5103==  Address 0x57E000C is not stack'd, malloc'd or (recently) free'd
==5103== 
==5103== Invalid read of size 1
==5103==    at 0x4C0307: MYSQLlex(void*, void*) (sql_lex.cc:711)
==5103==    by 0x577300: MYSQLparse(void*) (sql_yacc.cc:14653)
==5103==    by 0x573389: mysql_parse(THD*, char const*, unsigned, char const**) (sql_parse.cc:6402)
==5103==    by 0x574030: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1961)
==5103==    by 0x575B46: handle_one_connection (sql_parse.cc:1642)
==5103==    by 0x328F8062F6: start_thread (in /lib64/libpthread-2.5.so)
==5103==    by 0x328ECD1E3C: clone (in /lib64/libc-2.5.so)
==5103==  Address 0x57E000C is not stack'd, malloc'd or (recently) free'd

How to repeat:
./configure --with-debug C_EXTRA_FLAGS=-DHAVE_purify
make
cd mysql-test
./mysql-test-run.pl --force --valgrind func_encrypt_nossl func_equal func_gconcat func_group func_if func_in func_isnull func_like func_math func_misc func_op func_regexp func_sapdb func_set func_str func_system func_test func_time func_timestamp gcc296 gis-rtree gis grant
[22 Sep 2009 2:23] Mark Callaghan
The valgrind warnings occurs from line 218 of mysql-test/t/grant.test

#
# Bug#3403 Wrong encoding in SHOW GRANTS, EXPLAIN SELECT output
#
SET NAMES koi8r;
CREATE DATABASE ÂÄ;
USE ÂÄ;
CREATE TABLE ÔÁÂ (ËÏÌ INT);

GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
SHOW GRANTS FOR ÀÚÅÒ@localhost;
REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;

GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;  <--- valgrind warning from this
[22 Sep 2009 6:25] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior nor with current development sources, neither with 5.0.85 although bug is repeatable with version 5.0.84. Please upgrade.
[22 Sep 2009 14:29] Mark Callaghan
My guess is that this bug was fixed by:
http://bugs.mysql.com/bug.php?id=45010