# Bug in IndexSearcher with limit =\> all and any offset

**URL:** <https://www.ruby-forum.com/t/bug-in-indexsearcher-with-limit-all-and-any-offset/85788>\
**Category:** Ferret\
**Created:** [February 16, 2007, 10:33am UTC](https://www.ruby-forum.com/t/bug-in-indexsearcher-with-limit-all-and-any-offset/85788 "2007-02-16T10:33:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahfeel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@ahfeel](https://www.ruby-forum.com/u/ahfeel)\
**Post date:** [February 16, 2007, 10:33am UTC](https://www.ruby-forum.com/t/bug-in-indexsearcher-with-limit-all-and-any-offset/85788/1 "2007-02-16T10:33:55Z")

</div>

Here’s the deal:

static TopDocs \*isea\_search\_w(Searcher \*self,  
Weight \*weight,  
int first\_doc, // OFFSET  
int num\_docs, // LIMIT  
Filter \*filter,  
Sort \*sort,  
filter\_ft filter\_func,  
bool load\_fields)  
{  
int max\_size = first\_doc + num\_docs;

Actually, when you have limit =\> :all, num\_docs equals to INT\_MAX, so  
adding a value to it makes a nice int overflow 😕

The diff patch is here:  
[http://pastie.caboo.se/40748](http://pastie.caboo.se/40748)

I’ve told Dave by mail but it seems like he’s very busy lately, hope  
someone else can release some fix here 🙂

–  
JÃ©rÃ©mie ‘ahFeel’ BORDIER  
Rift Technologies - [http://www.rift.fr](http://www.rift.fr)

---

<div class="post-metadata">

**Author:** ![ahfeel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@ahfeel](https://www.ruby-forum.com/u/ahfeel)\
**Post date:** [February 22, 2007, 8:34am UTC](https://www.ruby-forum.com/t/bug-in-indexsearcher-with-limit-all-and-any-offset/85788/2 "2007-02-22T08:34:43Z")

</div>

On 2/16/07, ahFeel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> {  
> int max\_size = first\_doc + num\_docs;
> 
> Actually, when you have limit =\> :all, num\_docs equals to INT\_MAX, so  
> adding a value to it makes a nice int overflow 😕
> 
> The diff patch is here:  
> [Parked at Loopia](http://pastie.caboo.se/40748)
> 
> I’ve told Dave by mail but it seems like he’s very busy lately, hope  
> someone else can release some fix here 🙂

Thanks Jérémie, this bug has been fixed.
