<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thank you!</p>
    <p>Looks like this indeed fixes the issue.<br>
    </p>
    <div class="moz-cite-prefix">On 11/10/20 4:46 PM, Timo Sirainen
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9DE6126A-FD82-4F4F-99EB-90397FE388D3@sirainen.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      On 10. Nov 2020, at 15.45, Timo Sirainen <<a
        href="mailto:timo@sirainen.com" class="" moz-do-not-send="true">timo@sirainen.com</a>>
      wrote:<br class="">
      <div>
        <blockquote type="cite" class=""><br
            class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8" class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              line-break: after-white-space;" class="">On 4. Nov 2020,
              at 13.24, Renaud Métrich <<a
                href="mailto:rmetrich@redhat.com" class=""
                moz-do-not-send="true">rmetrich@redhat.com</a>>
              wrote:<br class="">
              <div class="">
                <blockquote type="cite" class="">I would like to report
                  an issue which is 100% reproducible with a specific
                  mail available in the reproducer attached to <a
                    moz-do-not-send="true"
                    href="https://bugzilla.redhat.com/show_bug.cgi?id=1894418"
                    class="">Red Hat's bugzilla</a> (<a
                    class="moz-txt-link-freetext"
                    href="https://bugzilla.redhat.com/attachment.cgi?id=1726535"
                    moz-do-not-send="true">https://bugzilla.redhat.com/attachment.cgi?id=1726535</a>):<br
                    class="">
                  <div class="">
                    <div class="">
                      <div class="">When performing a "FETCH <ID>
                        (BINARY.SIZE[1]</div>
                      <pre class="">      BINARY.PEEK[1])" operation, imap crashes with following backtrace:</pre>
                    </div>
                  </div>
                </blockquote>
                <br class="">
              </div>
              <div class="">Thanks, this should fix it:</div>
              <div class=""><br class="">
              </div>
              <div class="">diff --git
                a/src/lib-storage/index/index-mail-binary.c
                b/src/lib-storage/index/index-mail-binary.c<br class="">
                index 2577f1afe5..f7bf984916 100644<br class="">
                --- a/src/lib-storage/index/index-mail-binary.c<br
                  class="">
                +++ b/src/lib-storage/index/index-mail-binary.c<br
                  class="">
                @@ -339,7 +339,7 @@ blocks_count_lines(struct binary_ctx
                *ctx, struct istream *full_input)<br class="">
                                i_stream_skip(full_input, skip);<br
                  class="">
                                cur_block_offset += skip;<br class="">
                <br class="">
                -               if (cur_block->input->eof) {<br
                  class="">
                +               if
                (i_stream_read_eof(cur_block->input)) {<br class="">
                                        /* go to the next block */<br
                  class="">
                                        if (++block_idx == block_count)
                {<br class="">
                                               
                i_assert(i_stream_read_eof(full_input));</div>
            </div>
          </div>
        </blockquote>
      </div>
      <br class="">
      <div class="">Actually, that breaks things. This one should be ok:</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div class="">diff --git
          a/src/lib-storage/index/index-mail-binary.c
          b/src/lib-storage/index/index-mail-binary.c</div>
        <div class="">index 2577f1afe5..80c319e050 100644</div>
        <div class="">--- a/src/lib-storage/index/index-mail-binary.c</div>
        <div class="">+++ b/src/lib-storage/index/index-mail-binary.c</div>
        <div class="">@@ -339,13 +339,14 @@ blocks_count_lines(struct
          binary_ctx *ctx, struct istream *full_input)</div>
        <div class="">                i_stream_skip(full_input, skip);</div>
        <div class="">                cur_block_offset += skip;</div>
        <div class=""><br class="">
        </div>
        <div class="">-               if (cur_block->input->eof) {</div>
        <div class="">+               if
          (i_stream_read_eof(cur_block->input)) {</div>
        <div class="">                        /* go to the next block */</div>
        <div class="">-                       if (++block_idx ==
          block_count) {</div>
        <div class="">+                       if (block_idx+1 ==
          block_count) {</div>
        <div class="">                               
          i_assert(i_stream_read_eof(full_input));</div>
        <div class="">                                ret = -1;</div>
        <div class="">                                break;</div>
        <div class="">                        }</div>
        <div class="">+                       block_idx++;</div>
        <div class="">                        cur_block++;</div>
        <div class="">                        cur_block_offset = 0;</div>
        <div class="">                }</div>
      </div>
    </blockquote>
  </body>
</html>