diff options
author | unknown <dean@mysql.com> | 2005-02-16 17:35:00 -0600 |
---|---|---|
committer | unknown <dean@mysql.com> | 2005-02-16 17:35:00 -0600 |
commit | 6bb46afb5d6f2171e8eec7691c0349b2eeff70d0 (patch) | |
tree | 0619d5ed4fae59f365eaa45b8576979f77bf3797 /myisam | |
parent | 8cf5a1cccb91d2c6a7993f0af6c75442b7fef7bf (diff) | |
parent | d8b0113653f3e6468ae46e5952d8bd5d82bcff74 (diff) | |
download | mariadb-git-6bb46afb5d6f2171e8eec7691c0349b2eeff70d0.tar.gz |
Merge mysql.com:/home/dellis/bkl/bug-4.1
into mysql.com:/home/dellis/bkl/bug-5.0
BitKeeper/etc/logging_ok:
auto-union
mysql-test/r/fulltext.result:
Auto merged
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/ft_nlq_search.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 83de6acdab9..7a506fd11c6 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -261,6 +261,10 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, } + /* + If ndocs == 0, this will not allocate RAM for FT_INFO.doc[], + so if ndocs == 0, FT_INFO.doc[] must not be accessed. + */ dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+ sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1), MYF(0)); @@ -329,7 +333,8 @@ float ft_nlq_find_relevance(FT_INFO *handler, else a=c; } - if (docs[a].dpos == docid) + /* bounds check to avoid accessing unallocated handler->doc */ + if (a < handler->ndocs && docs[a].dpos == docid) return (float) docs[a].weight; else return 0.0; |