Skip to main content.
home | support | download

Back to List Archive

Re: SWISH-E Bug: Infinite Loop in uncompress1() on error

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Fri Dec 10 2004 - 22:32:39 GMT
On Fri, Dec 10, 2004 at 02:12:53PM -0800, Patrick O'Lone wrote:
> Hello all,
> 
> We use Swish-E over NFS and occasionally we get corrupt indexes. As a 
> result, we've witnessed an error that can occur when the zlib compress 
> fails AND you use -L option. Basically, in the uncompress1() function in 
> compress.c, an infinite loop occurs because f_getc() is failing and not 
> being handled. The fix is as follows:

Two patches within a day of releasing 2.4.3.

Can you explain a bit more about this?  I assume it only shows up with
-L because -L is reading properties (which are compressed with zlib).

It there another problem?  That is, is uncompress1 being called when
it shouldn't be called?


> 
> /* Uncompress a number from a file */
> int     uncompress1(FILE * fp, int (*f_getc) (FILE *))
> {
>      int     _c;
>      int     num = 0;
> 
>      do
>      {
>          _c = (int) f_getc(fp);
> 	/* BEGIN FIX */
>          if (_c < 0) {
>              break;
>          }
> 	/* END FIX */

Are you checking for EOF there?  Should that be instead:

           if ( feof(fp) ) 
               break;


Thanks,

-- 
Bill Moseley
moseley@hank.org

Unsubscribe from or help with the swish-e list: 
   http://swish-e.org/Discussion/

Help with Swish-e:
   http://swish-e.org/current/docs
   swish-e@sunsite.berkeley.edu
Received on Fri Dec 10 14:32:40 2004