[Groonga-commit] groonga/groonga at 4ee3f28 [master] hash: limit the hash table size to avoid crash

Back to archive index

Susumu Yata null+****@clear*****
Wed Jul 13 15:28:00 JST 2016


Susumu Yata	2016-07-13 15:28:00 +0900 (Wed, 13 Jul 2016)

  New Revision: 4ee3f2818778b3ec6e69424a648ba023bd231cba
  https://github.com/groonga/groonga/commit/4ee3f2818778b3ec6e69424a648ba023bd231cba

  Message:
    hash: limit the hash table size to avoid crash

  Modified files:
    lib/hash.c

  Modified: lib/hash.c (+4 -0)
===================================================================
--- lib/hash.c    2016-07-13 15:15:26 +0900 (0ce6858)
+++ lib/hash.c    2016-07-13 15:28:00 +0900 (5eb86c5)
@@ -2461,6 +2461,10 @@ grn_hash_add(grn_ctx *ctx, grn_hash *hash, const void *key,
 
     /* lock */
     if ((*hash->n_entries + *hash->n_garbages) * 2 > *hash->max_offset) {
+      if (*hash->max_offset > (1 << 29)) {
+        ERR(GRN_TOO_LARGE_OFFSET, "hash table size limit");
+        return GRN_ID_NIL;
+      }
       grn_hash_reset(ctx, hash, 0);
     }
 
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index