<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Correction: Bug exists since OTP-17.0.
      <br>
      <br>
      (and i tags R16B02_yielding_binary_to_term and
      OTP_R16B03_yielding_binary_to_term)
      <br>
      <br>
      /Sverker
    </p>
    <br>
    <div class="moz-cite-prefix">On 01/20/2017 05:15 PM, Sverker
      Eriksson wrote:<br>
    </div>
    <blockquote
      cite="mid:9601eb43-5c52-7864-8b0c-78d76e6181a8@ericsson.com"
      type="cite">This is indeed a problem in Erlang VM code (shallow
      copy of inflate state)
      <br>
      that has existed since R16B03, but not caused actual problem until
      zlib v1.2.9.
      <br>
      <br>
      Fix coming up. Here is a preliminary patch for the impatient.
      <br>
      <br>
      diff --git a/erts/emulator/beam/external.c
      b/erts/emulator/beam/external.c
      <br>
      index beed847..1c4fff5 100644
      <br>
      --- a/erts/emulator/beam/external.c
      <br>
      +++ b/erts/emulator/beam/external.c
      <br>
      @@ -1431,6 +1431,10 @@ static B2TContext*
      b2t_export_context(Process* p, B2TContext* src)
      <br>
           if (ctx->state >= B2TDecode &&
      ctx->u.dc.next == &src->u.dc.res) {
      <br>
               ctx->u.dc.next = &ctx->u.dc.res;
      <br>
           }
      <br>
      +    else if (ctx->state == B2TUncompressChunk) {
      <br>
      +        int cres = inflateCopy(&ctx->u.uc.stream,
      &src->u.uc.stream);
      <br>
      +        ASSERT(cres == Z_OK); (void)cres;
      <br>
      +    }
      <br>
           hp = HAlloc(p, PROC_BIN_SIZE);
      <br>
           ctx->trap_bin = erts_mk_magic_binary_term(&hp,
      &MSO(p), context_b);
      <br>
           return ctx;
      <br>
      <br>
      <br>
      /Sverker, Erlang/OTP
      <br>
      <br>
      <br>
      On 01/20/2017 02:49 AM, Jeremy Huffman wrote:
      <br>
      <blockquote type="cite">I opened a Github issue with zlib.
        <a class="moz-txt-link-freetext" href="https://github.com/madler/zlib/issues/206">https://github.com/madler/zlib/issues/206</a>.
        <br>
        Mark Adler (zlib maintainer's) response:
        <br>
        <br>
        "Isolating it to that commit points to a problem in the
        application code,
        <br>
        where it must be inadvertently stomping on the deflate state,
        e.g. with an
        <br>
        out-of-bounds write into memory, or perhaps that the code is
        trying to use
        <br>
        the deflate state after it has been closed. The only change that
        commit
        <br>
        made was to check the integrity of the deflate structure more
        thoroughly on
        <br>
        each call of a deflate* function."
        <br>
        <br>
        On Thu, Jan 19, 2017 at 2:11 PM, Michel Boaventura <
        <br>
        <a class="moz-txt-link-abbreviated" href="mailto:michel.boaventura@gmail.com">michel.boaventura@gmail.com</a>> wrote:
        <br>
        <br>
        <blockquote type="cite">Hi,
          <br>
          <br>
          I've done the bisect and find the culprit: <a class="moz-txt-link-freetext" href="https://github.com/">https://github.com/</a>
          <br>
          madler/zlib/commit/b516b4bdd7c0c9f0858adfebf732089014f7b282.
          Before this
          <br>
          commit term_to_binary works and stop doing so afterwards. I
          will have a
          <br>
          look at the changes and see if I can figure out what happened.
          <br>
          <br>
          Cheers,
          <br>
          <br>
          <br>
          On 19 January 2017 at 16:15, Michel Boaventura <
          <br>
          <a class="moz-txt-link-abbreviated" href="mailto:michel.boaventura@gmail.com">michel.boaventura@gmail.com</a>> wrote:
          <br>
          <br>
          <blockquote type="cite">Hi all,
            <br>
            <br>
            I'm indeed using zlib 1.2.11 on my gentoo. I can't downgrade
            it, since
            <br>
            all the other versions were removed from portage.
            <br>
            <br>
            I will clone zlib repo and see if I can bisect the problem.
            <br>
            <br>
            Thanks!
            <br>
            <br>
            On 19 January 2017 at 15:45, Jeremy Huffman
            <a class="moz-txt-link-rfc2396E" href="mailto:jeremy@jeremyhuffman.com"><jeremy@jeremyhuffman.com></a>
            <br>
            wrote:
            <br>
            <br>
            <blockquote type="cite">Yes it's exactly the same error
              message from dialyzer. And the fact that
              <br>
              he's getting it on Gentoo which builds from source
              suggests that it is not
              <br>
              simply a matter of recompiling the dependency chain, which
              was a suggestion
              <br>
              in the Arch board. There was another app in Arch that also
              had a problem
              <br>
              pinned on zlib 1.2.11.
              <br>
              <br>
              <br>
              On Thu, Jan 19, 2017 at 11:33 AM Kostis Sagonas
              <a class="moz-txt-link-rfc2396E" href="mailto:kostis@cs.ntua.gr"><kostis@cs.ntua.gr></a>
              <br>
              wrote:
              <br>
              <br>
              <blockquote type="cite">On 01/19/2017 03:42 AM, Jeremy
                Huffman wrote:
                <br>
                <br>
                <blockquote type="cite">Hi,
                  <br>
                  I'm an Arch Linux user and picked up an update a few
                  days ago that
                  <br>
                </blockquote>
                broke
                <br>
                <br>
                <blockquote type="cite">dialyzer. I bisected the last
                  few days of updates and then narrowed
                  <br>
                </blockquote>
                the
                <br>
                <br>
                <blockquote type="cite">problem to zlib 1.2.10, which
                  was released January 2nd. 1.2.11 was
                  <br>
                  released on the 15th as an emergency bug fix and does
                  not fix the
                  <br>
                  problem. Reverting my system back to 1.2.8 (the
                  previous version
                  <br>
                  packaged for Arch) did resolve the issue.
                  <br>
                  It seems doubtful this is an Erlang problem, but I
                  doubt I'm going to
                  <br>
                  write a test program to demonstrate the problem to
                  them.  I thought I
                  <br>
                  should at least report the issue in case others
                  encounter it.
                  <br>
                  To reproduce, one would need only install zlib 1.2.10
                  and then run:
                  <br>
                  dialyzer --verbose --build_plt --apps erts
                  --output_plt test.plt
                  <br>
                  Output would be along the lines of:
                  <br>
                  dialyzer: Could not get abstract code for file:
                  <br>
                  /usr/lib/erlang/lib/erts-8.2/ebin/erlang.beam (please
                  recompile it
                  <br>
                </blockquote>
                with
                <br>
                <br>
                <blockquote type="cite">+debug_info)
                  <br>
                  There are also errors when simply trying to do success
                  typing analysis
                  <br>
                  *using* any pre-existing PLT file, along lines of
                  "this isn't a PLT
                  <br>
                  file". The errors are not dependent upon the version
                  of Erlang
                  <br>
                </blockquote>
                installed
                <br>
                <br>
                <blockquote type="cite">- at least anything I tried that
                  was released on Arch in the 19.x
                  <br>
                </blockquote>
                branch
                <br>
                <br>
                <blockquote type="cite">will reproduce the problem.
                  <br>
                  Anyway, I hope this report helps someone and I would
                  be curious if
                  <br>
                  anyone else reproduces it, or especially if they fail
                  to reproduce it.
                  <br>
                </blockquote>
                <br>
                <br>
                Earlier today (yesterday?), there was the following
                question on the
                <br>
                <br>
                erlang-questions mailing list:
                <br>
                <br>
                <br>
                <br>
                   
                <a class="moz-txt-link-freetext" href="http://erlang.org/pipermail/erlang-questions/2017-January/0">http://erlang.org/pipermail/erlang-questions/2017-January/0</a>
                <br>
                91434.html
                <br>
                <br>
                <br>
                <br>
                I am willing to bet that problem with binary_to_term is
                also caused by
                <br>
                <br>
                zlib troubles.
                <br>
                <br>
                <br>
                <br>
                Perhaps Michel (cc:) can inform us about his zlib
                version.
                <br>
                <br>
                <br>
                <br>
                Kostis
                <br>
                <br>
                <br>
              </blockquote>
            </blockquote>
            <br>
            --
            <br>
            Michel Almada de Castro Boaventura
            <br>
            Analista de Sistemas
            <br>
            Laboratório de Software Livre - LSL
            <br>
            <br>
          </blockquote>
          <br>
          <br>
          --
          <br>
          Michel Almada de Castro Boaventura
          <br>
          Analista de Sistemas
          <br>
          Laboratório de Software Livre - LSL
          <br>
          <br>
        </blockquote>
        <br>
        <br>
        _______________________________________________
        <br>
        erlang-bugs mailing list
        <br>
        <a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
        <br>
        <a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
        <br>
      </blockquote>
      <br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
erlang-bugs mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-bugs">http://erlang.org/mailman/listinfo/erlang-bugs</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>