# Segmentation fault in Index::Index#add\_document

**URL:** <https://www.ruby-forum.com/t/segmentation-fault-in-index-index-add-document/83779>\
**Category:** Ferret\
**Created:** [January 29, 2007, 6:05pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-index-index-add-document/83779 "2007-01-29T18:05:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [January 29, 2007, 6:05pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-index-index-add-document/83779/1 "2007-01-29T18:05:04Z")

</div>

Hello,

Here’s the code that segfaults:

[http://pastie.caboo.se/36467](http://pastie.caboo.se/36467)

I could have submitted a patch, but I’m not sure  
whether this segfault is caused by Ferret or Ruby.

This seems to be triggered only when combining  
a split and a gsub on an empty string of the returned  
array, and trying to insert it directly into the  
index.

However, there’s no problem when you duplicate or  
transform the string.

–  
maz  
Rift Technologies - [http://rift.fr/](http://rift.fr/)

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [January 29, 2007, 6:56pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-index-index-add-document/83779/2 "2007-01-29T18:56:53Z")

</div>

Hi,

reproduced here on Ubuntu Edgy Intel.

Program received signal SIGSEGV, Segmentation fault.  
[Switching to Thread -1211037504 (LWP 6193)]  
0xb79b878e in mb\_std\_advance\_to\_start (ts=0x816ae20) at analysis.c:156  
156 {  
(gdb) bt  
#0 0xb79b878e in mb\_std\_advance\_to\_start (ts=0x816ae20) at  
analysis.c:156

Have you reported this on the bug tracker?

[http://ferret.davebalmain.com/trac/report/1](http://ferret.davebalmain.com/trac/report/1)

## John.

[http://johnleach.co.uk](http://johnleach.co.uk)

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [January 29, 2007, 11:25pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-index-index-add-document/83779/3 "2007-01-29T23:25:59Z")

</div>

John L. wrote:  
[…]

> Have you reported this on the bug tracker?
> 
> [http://ferret.davebalmain.com/trac/report/1](http://ferret.davebalmain.com/trac/report/1)

Done, thanks.  
I still think it’s probably a Ruby bug.

–  
maz  
Rift Technologies - [http://rift.fr/](http://rift.fr/)
