Bug #69517 | Inconsistent result in stored procedure | ||
---|---|---|---|
Submitted: | 19 Jun 2013 16:25 | Modified: | 2 Oct 2013 20:59 |
Reporter: | Jeff Russo | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S2 (Serious) |
Version: | 5.5.31 | OS: | Other (Ubuntu 12.04) |
Assigned to: | CPU Architecture: | Any | |
Tags: | point, spatial, stored procedure |
[19 Jun 2013 16:25]
Jeff Russo
[19 Jun 2013 17:22]
MySQL Verification Team
It's reading freed memory. Hence, crash is even possible in addition to wrong results. Version: '5.6.13' MySQL Community Server (GPL) Thread 22: Invalid read of size 1 at4: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:882) by: Protocol::net_store_data(unsigned char const*, unsigned long) (protocol.cc:58) by: Protocol_text::store(Field*) (protocol.cc:1121) by: Protocol::send_result_set_row (protocol.cc:847) by: select_send::send_data (sql_class.cc:2489) by: JOIN::exec (sql_executor.cc:148) by: mysql_execute_select (sql_select.cc:1100) by: mysql_select (sql_select.cc:1221) by: handle_select (sql_select.cc:110) by: execute_sqlcom_select (sql_parse.cc:5044) by: mysql_execute_command (sql_parse.cc:2602) by: sp_instr_stmt::exec_core (sp_instr.cc:881) by: sp_lex_instr::reset_lex_and_exec_core (sp_instr.cc:382) by: sp_lex_instr::validate_lex_and_execute_core(THD*, unsigned int*, bool) (sp_instr.cc:610) by: sp_instr_stmt::execute (sp_instr.cc:788) by: sp_head::execute (sp_head.cc:645) by: sp_head::execute_procedure(THD*, List<Item>*) (sp_head.cc:1307) by: mysql_execute_command (sql_parse.cc:4520) by: mysql_parse (sql_parse.cc:6185) by: dispatch_command (sql_parse.cc:1332) by: do_handle_one_connection (sql_connect.cc:977) by: handle_one_connection (sql_connect.cc:893) by: start_thread (pthread_create.c:309) by: clone (clone.S:115) ==3393== Address 0x141c65f0 is 144 bytes inside a block of size 16,504 free'd at: free (vg_replace_malloc.c:468) by: mem_area_free (mem0pool.cc:519) by: mem_heap_block_free (mem0mem.cc:518) by: mem_heap_free_func (mem0mem.ic:495) by: row_mysql_prebuilt_free_blob_heap (row0mysql.cc:169) by: ha_innobase::reset (ha_innodb.cc:11849) by: close_thread_table (sql_base.cc:1502) by: close_open_tables (sql_base.cc:1241) by: mysql_execute_command (sql_parse.cc:4965) by: sp_instr_stmt::exec_core (sp_instr.cc:881) by: sp_lex_instr::reset_lex_and_exec_core (sp_instr.cc:382) by: sp_lex_instr::validate_lex_and_execute_core (sp_instr.cc:610) by: sp_instr_stmt::execute (sp_instr.cc:788) by: sp_head::execute (sp_head.cc:645) by: sp_head::execute_procedure (sp_head.cc:1307) by: mysql_execute_command (sql_parse.cc:4520) by: mysql_parse (sql_parse.cc:6185) by: dispatch_command (sql_parse.cc:1332) by 0x6FDF96: do_handle_one_connection (sql_connect.cc:977) by 0x6FE01F: handle_one_connection (sql_connect.cc:893) by 0x3679C07D13: start_thread (pthread_create.c:309) by 0x36798F168C: clone (clone.S:115)
[19 Jun 2013 17:32]
MySQL Verification Team
Reduced testcase to show a problem: Run mysqld in valgrind, or notice varying results from the call to p1. ----- delimiter ; drop table if exists `t1`; create table `t1`(`z` point)engine=innodb; insert into `t1` values(geomfromtext('point(1 1)')); delimiter $ drop procedure if exists `p1`$ create procedure `p1`() begin declare `e` point default null; select `z` into `e` from `t1`; select now(),version(),hex(`e`),`e`; end $ delimiter ; call `p1`(); -----
[2 Oct 2013 20:59]
Paul DuBois
Noted in 5.7.3 changelog. Reads of Geometry values within a stored program could read already-freed memory and produce incorrect results.