Bug #13582 Fulltext RAM overallocation when searching for only stopwords
Submitted: 28 Sep 2005 18:51 Modified: 13 Oct 2005 4:11
Reporter: Dean Ellis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:
Assigned to: Dean Ellis CPU Architecture:Any

[28 Sep 2005 18:51] Dean Ellis
Description:
ft_init_nlq_search() potentially miscalculates how much RAM it should malloc() when a search is performed against only stopwords.

How to repeat:
n/a

Suggested fix:
===== ft_nlq_search.c 1.38 vs edited =====
--- 1.38/myisam/ft_nlq_search.c 2005-02-15 17:30:39 -06:00
+++ edited/ft_nlq_search.c      2005-09-28 13:50:28 -05:00
@@ -266,7 +266,8 @@
     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),
+                            sizeof(FT_DOC)*
+                            (int)(aio.dtree.elements_in_tree-1),
                             MYF(0));
   if (!dlist)
     goto err;
[29 Sep 2005 0:03] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/30473
[6 Oct 2005 21:24] Dean Ellis
Fixed in 4.1.15 and 5.0.15.
[13 Oct 2005 4:11] Mike Hillyer
Documented in 4.1.15 and 5.0.15 changelogs:

  <listitem>
        <para>
          Server may over-allocate memory when performing a FULLTEXT
          search for stopwords only. (Bug #13582)
        </para>
      </listitem>