diff options
author | ramil/ram@mysql.com/ramil.myoffice.izhnet.ru <> | 2008-02-12 15:12:45 +0400 |
---|---|---|
committer | ramil/ram@mysql.com/ramil.myoffice.izhnet.ru <> | 2008-02-12 15:12:45 +0400 |
commit | a64d12ce3a7da13c60bf9c486341dcdda4cfd116 (patch) | |
tree | a0ad83ccf9ebfb276061781a85d3d51d939636dc /myisam | |
parent | 3b5c25ba656187eac5c20625cdc3a93e22f2eb93 (diff) | |
download | mariadb-git-a64d12ce3a7da13c60bf9c486341dcdda4cfd116.tar.gz |
Fix for bug #33758: Got query result when using ORDER BY ASC, but
empty result when using DESC
Problem: fetching MyISAM keys we copy a key block pointer to the end of the key buffer.
However, we don't take into account the pointer length calculatig the buffer size,
that may leads to memory overwriting and in turn to unpredictable results.
Fix: increase key buffer size by length of the key block pointer.
Note: no simple test case.
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_open.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 5314d6a9a6c..d4d8458a669 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -270,6 +270,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) if (share->options & HA_OPTION_COMPRESS_RECORD) share->base.max_key_length+=2; /* For safety */ + /* Add space for node pointer */ + share->base.max_key_length+= share->base.key_reflength; + if (!my_multi_malloc(MY_WME, &share,sizeof(*share), &share->state.rec_per_key_part,sizeof(long)*key_parts, |