Skip to content

mod_deflate: read gzip extra field length as unsigned char - #839

Open
arshsmith1 wants to merge 1 commit into
apache:trunkfrom
arshsmith1:deflate-xlen-unsigned
Open

arshsmith1 wants to merge 1 commit into
apache:trunkfrom
arshsmith1:deflate-xlen-unsigned

Conversation

@arshsmith1

Copy link
Copy Markdown

consume_zlib_flags() reads the two gzip extra-field (FEXTRA) length bytes through a plain char, so on platforms where char is signed a length byte with the high bit set gets sign-extended and consume_len ends up near UINT_MAX instead of the real 0-65535 length. That makes the DEFLATE input filter (inflating a client gzip request body) and the INFLATE output filter (e.g. a proxied gzip response) mis-parse the header of any gzip stream whose extra-field length low byte is >= 0x80; an ordinary 200-byte extra field (XLEN 0x00C8) already trips it, after which the remainder of the member is swallowed as if it were still the extra field. Reading each byte through unsigned char before widening keeps the decode correct, with no change for any stream whose low length byte is under 0x80.


  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant