Skip to content

Use-of-uninitialized-value in inflate() #245

Closed

Description

@npm1

There are a couple of places in inflate() where UPDATE is called with state->check as its first parameter, without a guarantee that this value has been initialized (state comes from a ZALLOC in inflateInit). This causes use of uninitialized check value.

Suggested fix:
Add state->check=0; around here:
https://github.com/madler/zlib/blob/master/inflate.c#L230

Activity

  1. madler commented on Mar 30, 2017

    @madler
    Owner

    No, it's guaranteed if UPDATE is called. You'd need to follow the logic.

  2. npm1 commented on Mar 30, 2017

    @npm1
    Author

    "Following the logic" in this method is hard, it's huge. I have a testcase for this, but I don't think I'm allowed to share it. It was obtained using Chromium fuzzers. I'll share the state->mode sequence:

    First inflate: HEAD -> BAD.
    inflateSync: TYPE (the method returns Z_OK)
    Second inflate: TYPEDO -> LEN_ -> LIT -> LEN->LIT->LEN->LIT->LEN->LEN->TYPE->CHECK and it uses the uninitialized value state->check there.

  3. madler commented on Apr 16, 2017

    @madler
    Owner

    You were correct -- it was possible for inflateSync() to leave inflate in an inconsistent state if header decoding was requested, but no header was ever processed. This commit fixes that:
    44e8ac8

  4. npm1 commented on May 9, 2017

    @npm1
    Author

    Sorry for the late reply, I checked if the problem was solved with your patch but it was not. Now I got permission to share the testcase with you. It is for libtiff but the uninitialized values are in zlib. Please let me know how I could share it with you.

  5. npm1 commented on Jun 26, 2017

    @npm1
    Author

    Ping. The commit mentioned does not fix the issue for our testcase. Is there any plan to fix this upstream or should Chromium patch its own version of zlib?

  6. npm1 commented on Jun 27, 2017

    @npm1
    Author

    It bounced :( "One of your attachments contained a virus. Your message was not sent."
    I guess it thinks the libtiff testcase is somehow dangerous.

  7. madler commented on Jun 28, 2017

    @madler
    Owner

    Send me an email without an attachment, and I'll reply with a different email address for you to try.

  8. npm1 commented on Aug 3, 2017

    @npm1
    Author

    I will be patching Chromium's copy of zlib because this is marked as a security bug and it has been open for too long.

  9. 21 remaining items

  10. added 2 commits that reference this issue on Jan 18, 2022
  11. added 2 commits that reference this issue on Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions