[Textsearch-ja-general] textsearch_sennaで特定の文字列をINSERTするとプロセスがクラッシュしてしまう

おさ osa at osa-p.net
Fri Mar 5 02:11:47 UTC 2010


こんにちは、おさです。

senna本家のMLにて問い合わせを行い、lib/str.cのnormalize_utf8関数内を
以下のように修正することで、問題が解決することを確認しました。

--- str.c       (revision 1299)
+++ str.c       (working copy)
@@ -428,11 +428,11 @@
   uint_least8_t *cp, *ctypes;
   size_t length = 0, ls, lp, size = nstr->orig_blen;
   int removeblankp = nstr->flags & SEN_STR_REMOVEBLANK;
-  if (!(nstr->norm = SEN_MALLOC(size * 5 + 1))) { /* todo:
reallocunless enough */
+  if (!(nstr->norm = SEN_MALLOC(size * 11 + 1))) { /* todo:
reallocunless enough */
     return sen_memory_exhausted;
   }
   if (nstr->flags & SEN_STR_WITH_CHECKS) {
-    if (!(nstr->checks = SEN_MALLOC(size * 5 * sizeof(int16_t) + 1)))
{/* todo: realloc unless enough */
+    if (!(nstr->checks = SEN_MALLOC(size * 11 * sizeof(int16_t) +
1))){ /* todo: realloc unless enough */
       SEN_FREE(nstr->norm);
       nstr->norm = NULL;
       return sen_memory_exhausted;
@@ -440,7 +440,7 @@
   }
   ch = nstr->checks;
   if (nstr->flags & SEN_STR_WITH_CTYPES) {
-    if (!(nstr->ctypes = SEN_MALLOC(size * 3 + 1))) { /* todo:
reallocunless enough */
+    if (!(nstr->ctypes = SEN_MALLOC(size * 11 + 1))) { /* todo:
reallocunless enough */
       SEN_FREE(nstr->checks);
       SEN_FREE(nstr->norm);
       nstr->checks = NULL;

以上です。

+-----------------------------------------------------------------------+
 HANDLE:おさ
 EMAIL :osa at osa-p.net twitter:osapon URL:http://www.osa-p.net/
+-----------------------------------------------------------------------+


More information about the Textsearch-ja-general mailing list