Hmmm... seems to be another problem. I guess instead of "break" we need
to throw a fatal error via progerr(), otherwise, a pointer is always
returned and an infinite loop still occurs in looping functions that
call uncompress1().
Bill Moseley wrote:
> 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,
>
--
Patrick O'Lone
Software Project Manager
TownNews.com
E-mail ... polone@townnews.com
Phone .... 309-743-0809
Fax ...... 309-743-0830
Received on Mon Dec 13 10:24:18 2004