[Groonga-commit] groonga/groonga [master] Fixed a bug in grn_ctx_alloc() cause segv.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 6月 24日 (木) 09:24:57 JST


Daijiro MORI	2010-06-24 00:24:57 +0000 (Thu, 24 Jun 2010)

  New Revision: eac541769af9c3c5797efabe772e40a24908d732

  Log:
    Fixed a bug in grn_ctx_alloc() cause segv.

  Modified files:
    lib/ctx.c

  Modified: lib/ctx.c (+3 -2)
===================================================================
--- lib/ctx.c    2010-06-24 00:18:03 +0000 (dc2eabc)
+++ lib/ctx.c    2010-06-24 00:24:57 +0000 (40a4ae0)
@@ -1405,8 +1405,9 @@ grn_ctx_alloc(grn_ctx *ctx, size_t size, int flags,
       mi->count++;
       header[0] = i;
       header[1] = (int32_t) size;
-      if ((flags & GRN_CTX_ALLOC_CLEAR) && (mi->count & GRN_CTX_SEGMENT_DIRTY)) {
-        memset(&header[2], 0, size);
+      if ((flags & GRN_CTX_ALLOC_CLEAR) &&
+          (mi->count & GRN_CTX_SEGMENT_DIRTY) && (size > ALIGN_SIZE)) {
+        memset(&header[2], 0, size - ALIGN_SIZE);
       }
     }
     /*




Groonga-commit メーリングリストの案内
Back to archive index