[Groonga-commit] groonga/groonga [master] Fixed a bug in grn_pat_at() cause segv when nonexistent id is assigned.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 10月 22日 (金) 15:45:08 JST


Daijiro MORI	2010-10-22 06:45:08 +0000 (Fri, 22 Oct 2010)

  New Revision: 0c1205b8bb6b5514765e9e49ff7d45df3b26420f

  Log:
    Fixed a bug in grn_pat_at() cause segv when nonexistent id is assigned.

  Modified files:
    lib/pat.c

  Modified: lib/pat.c (+1 -1)
===================================================================
--- lib/pat.c    2010-10-21 04:19:31 +0000 (ad95e8c)
+++ lib/pat.c    2010-10-22 06:45:08 +0000 (1ad7810)
@@ -1436,7 +1436,7 @@ grn_pat_at(grn_ctx *ctx, grn_pat *pat, grn_id id)
 {
   uint32_t key_size;
   const char *key = _grn_pat_key(ctx, pat, id, &key_size);
-  if (id == _grn_pat_get(ctx, pat, key, key_size, NULL)) { return id; }
+  if (key && (id == _grn_pat_get(ctx, pat, key, key_size, NULL))) { return id; }
   return GRN_ID_NIL;
 }
 




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