gzip compressed mbox: Panic: file istream-zlib.c: line 421 (i_stream_zlib_seek): assertion failed: (ret == -1)

Anton Yuzhaninov citrin at citrin.ru
Wed Jul 5 21:57:21 EEST 2017


On 07/05/17 14:35, Aki Tuomi wrote:
>>>> I have errors in logs:
>>>> Panic: file istream-zlib.c: line 416 (i_stream_zlib_seek): assertion
>>>> failed: (ret == -1)
>> ...
>>>> The bug appeared in 2.2.26 and still can be reproduced (in 2.2.31)
...
>> May be better fix will be:
>> index f7354d83d..06389362a 100644
>> --- a/src/lib-compression/istream-zlib.c
>> +++ b/src/lib-compression/istream-zlib.c
>> @@ -404,7 +404,7 @@ i_stream_zlib_seek(struct istream_private *stream,
>> uoff_t v_offset, bool mark)
>>                 stream->pos = stream->skip;
>>         } else {
>>                 /* read and cache forward */
>> -               ssize_t ret = -1;
>> +               ssize_t ret;
>>
>>                 do {
>>                         size_t avail = stream->pos - stream->skip;
>> @@ -413,6 +413,7 @@ i_stream_zlib_seek(struct istream_private *stream,
>> uoff_t v_offset, bool mark)
>>                                 i_stream_skip(&stream->istream,
>>                                               v_offset -
>>                                               stream->istream.v_offset);
>> +                               ret = -1;
>>                                 break;
>>                         }
>>
>> It also works for me.
>>
>> Also similar code can be found in files for other compression formats.
> 
> Question is though, is the original code returning ret = -2? Is it possible for you find out?

In the core file, I had after assert(), ret value was some big positive
number, so in my case while loop was terminated by break statement.

I'm not familiar with dovecot code and can't say if i_stream_read
returning -2 is valid case for zlib, but probably assert was added,
because i_stream_read should not return -2 here.


More information about the dovecot mailing list