summaryrefslogtreecommitdiff
path: root/include/myisammrg.h
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-07-10 17:34:03 +0600
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-07-10 17:34:03 +0600
commit2b26729eceeebe6c19349d5a4d0010241bf92847 (patch)
tree491fcfae5d84cff9f10b2ea29d4687328e86f5ba /include/myisammrg.h
parent05e498ea3db8bcb99a3f3781ce3e400addecdba9 (diff)
downloadmariadb-git-2b26729eceeebe6c19349d5a4d0010241bf92847.tar.gz
Bug #45796: invalid memory reads and writes when altering merge
and base tables myrg_attach_children() could reuse a buffer that was allocated previously based on a definition of a child table. The problem was that the child's definition might have been changed, so reusing the buffer could lead to crashes or valgrind errors under some circumstances. Fixed by changing myrg_attach_children() so that the rec_per_key_part buffer is reused only when the child table have not changed, and reallocated otherwise (the old buffer is deallocated if necessary). include/myisammrg.h: Added a pointer to need_compat_check as an argument to myrg_attach_children(). mysql-test/r/merge.result: Added a test case for bug #45796. mysql-test/t/merge.test: Added a test case for bug #45796. storage/myisammrg/ha_myisammrg.cc: Pass a pointer to need_compat_check to myrg_attach_children(). storage/myisammrg/myrg_open.c: Changed myrg_attach_children() so that the rec_per_key_part buffer is reused only when the child table have not changed, and reallocated otherwise (the old buffer is deallocated if necessary).
Diffstat (limited to 'include/myisammrg.h')
-rw-r--r--include/myisammrg.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/myisammrg.h b/include/myisammrg.h
index dafae157ee0..446ecb7d719 100644
--- a/include/myisammrg.h
+++ b/include/myisammrg.h
@@ -88,7 +88,8 @@ extern MYRG_INFO *myrg_parent_open(const char *parent_name,
void *callback_param);
extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
MI_INFO *(*callback)(void*),
- void *callback_param);
+ void *callback_param,
+ my_bool *need_compat_check);
extern int myrg_detach_children(MYRG_INFO *m_info);
extern int myrg_panic(enum ha_panic_function function);
extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);