René's URL Explorer Experiment


Title: `zlib.decompressobj`: `decompress(b"", n)` and `flush()` never return output that inflate still holds (raw deflate loses its last bytes under `max_length`) · Issue #8907 · RustPython/RustPython · GitHub

Open Graph Title: `zlib.decompressobj`: `decompress(b"", n)` and `flush()` never return output that inflate still holds (raw deflate loses its last bytes under `max_length`) · Issue #8907 · RustPython/RustPython

X Title: `zlib.decompressobj`: `decompress(b"", n)` and `flush()` never return output that inflate still holds (raw deflate loses its last bytes under `max_length`) · Issue #8907 · RustPython/RustPython

Description: Environment RustPython d31ccae04d039ca3ab294742f2493aa5f2b63ff7, host build (x86_64-unknown-linux-gnu, debug), zlib.ZLIB_VERSION = 1.3.0-zlib-rs-0.6.8. crates/common/src/compression/zlib.rs on main (a7d75d25a7b2c291720411dc65445accd972e6...

Open Graph Description: Environment RustPython d31ccae04d039ca3ab294742f2493aa5f2b63ff7, host build (x86_64-unknown-linux-gnu, debug), zlib.ZLIB_VERSION = 1.3.0-zlib-rs-0.6.8. crates/common/src/compression/zlib.rs on main...

X Description: Environment RustPython d31ccae04d039ca3ab294742f2493aa5f2b63ff7, host build (x86_64-unknown-linux-gnu, debug), zlib.ZLIB_VERSION = 1.3.0-zlib-rs-0.6.8. crates/common/src/compression/zlib.rs on main...

Opengraph URL: https://github.com/RustPython/RustPython/issues/8907

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`zlib.decompressobj`: `decompress(b\"\", n)` and `flush()` never return output that inflate still holds (raw deflate loses its last bytes under `max_length`)","articleBody":"### Environment\n\n- RustPython `d31ccae04d039ca3ab294742f2493aa5f2b63ff7`, host build (x86_64-unknown-linux-gnu,\n  debug), `zlib.ZLIB_VERSION` = `1.3.0-zlib-rs-0.6.8`.\n- `crates/common/src/compression/zlib.rs` on `main` (`a7d75d25a7b2c291720411dc65445accd972e69d`,\n  2026-09-29) is byte-identical to `d31ccae`; the line numbers below hold for both.\n- Reference: CPython 3.13.5.\n\n### Reproducer\n\n```python\nimport zlib\nc = zlib.compressobj(6, zlib.DEFLATED, -15)  # raw deflate, no trailer\nraw = c.compress(b\"x\" * 1168) + c.flush()\nd = zlib.decompressobj(-15)\nout = d.decompress(raw, 100)\nwhile d.unconsumed_tail:\n    out += d.decompress(d.unconsumed_tail, 100)\nprint(\"all input consumed:\", len(out), \"of 1168, eof\", d.eof)\nmore = d.decompress(b\"\", 100)\nprint(\"decompress(b'', 100):\", len(more))\nrest = d.flush()\nprint(\"flush():\", len(rest), \"total:\", len(out + more + rest))\n```\n\nCPython 3.13.5:\n\n```text\nall input consumed: 1100 of 1168, eof False\ndecompress(b'', 100): 68\nflush(): 0 total: 1168\n```\n\nRustPython `d31ccae`:\n\n```text\nall input consumed: 1100 of 1168, eof False\ndecompress(b'', 100): 0\nflush(): 0 total: 1100\n```\n\nThe last 68 bytes stay inside the inflate state. The input is all consumed, so `unconsumed_tail` is\nempty, and neither `decompress(b\"\", n)` nor `flush()` runs inflate again.\n\nFrequency, the same drain loop plus `flush()`, sizes `n` in `range(1000, 3000, 7)`, `max_length`\nin `(64, 100, 256, 1024)` (1 144 cases):\n\n| | raw deflate (`wbits=-15`) short | zlib (`15`) and gzip (`31`) short |\n|---|---|---|\n| CPython 3.13.5 | 0 / 1 144 | 0 / 2 288 |\n| RustPython `d31ccae` | 196 / 1 144 | 0 / 2 288 |\n\nWith a zlib or gzip wrapper the trailer bytes are still unconsumed while output is pending, so\n`unconsumed_tail` is non-empty and the loop calls inflate again. Raw deflate has no trailer, so\nthe pending output can outlive the last input byte.\n\n### Source\n\n`crates/common/src/compression/zlib.rs`, `decompress_chunks`, lines 353–355:\n\n```rust\nif data.is_empty() {\n    return Ok((Vec::new(), false));\n}\n```\n\n`Decompressor::decompress` (line 690) passes `b\"\"` through `decompress_inner` →\n`decompress_all` → `decompress_chunks`, which returns before it calls inflate.\n`Decompressor::flush` (lines 701–709) takes `unconsumed_tail`, which is empty here, and reaches\nthe same early return, so the `InflateFlush::Finish` call never runs either. CPython calls inflate\nfor an empty input and returns the pending output.\n\nA fix has to keep the existing unit test `empty_input_does_not_finish_a_stream` (line 1000):\nan empty input before any compressed data MUST NOT set `eof`. #8752 aligned lzma to this same early\nreturn for that reason.\n\n### Impact\n\nAny consumer that decodes raw deflate with a bounded `max_length` and drains with\n`decompress(b\"\", n)` or `flush()` gets a truncated result with no error. One example is HTTP\n`Content-Encoding: deflate` sent as raw deflate, which urllib3's `DeflateDecoder` accepts after its\nfirst zlib-header attempt fails. I have not measured urllib3 end to end for this case.\n\nThe reproducers above were run locally on RustPython and CPython.\n\n---\n\n🤖 Written by Claude Code (2.1.283) using model claude-opus-5-5\n","author":{"url":"https://github.com/JMLX42","@type":"Person","name":"JMLX42"},"datePublished":"2026-09-29T15:51:37Z","url":"https://github.com/RustPython/RustPython/issues/8907"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1a999ca0-1411-0371-b5ac-6d12a3c7385e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id84C6:1DC4CC:1634563:1D8D08E:6B020691
html-safe-noncebc03b931adde865a6182b022a398c212266fe5ed318d50864a360338eed05e86
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEM2OjFEQzRDQzoxNjM0NTYzOjFEOEQwOEU6NkIwMjA2OTEiLCJ2aXNpdG9yX2lkIjoiNTI1NjM4MTkzMTU2OTk0MDExMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5a3a31cecc07c3fd48d7ac4443a01b9d97dc50c3883e4455a3c1e0de8d9ae4ae
hovercard-subject-tagissue:5633265806
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/8907/issue_layout
twitter:imagehttps://opengraph.githubassets.com/76c8a63efbde66c6dacd24673fc2068e57babb6eaead088c775f540d2709325e/RustPython/RustPython/issues/8907
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/76c8a63efbde66c6dacd24673fc2068e57babb6eaead088c775f540d2709325e/RustPython/RustPython/issues/8907
og:image:altEnvironment RustPython d31ccae04d039ca3ab294742f2493aa5f2b63ff7, host build (x86_64-unknown-linux-gnu, debug), zlib.ZLIB_VERSION = 1.3.0-zlib-rs-0.6.8. crates/common/src/compression/zlib.rs on main...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJMLX42
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/RustPython/RustPython/issues/8907#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fissues%2F8907
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fissues%2F8907
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/issues/8907
Reloadhttps://github.com/RustPython/RustPython/issues/8907
Reloadhttps://github.com/RustPython/RustPython/issues/8907
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
https://github.com/RustPython/RustPython
New issuehttps://github.com/login?return_to=https://github.com/RustPython/RustPython/issues/8907
New issuehttps://github.com/login?return_to=https://github.com/RustPython/RustPython/issues/8907
#8909https://github.com/RustPython/RustPython/pull/8909
zlib.decompressobj: decompress(b"", n) and flush() never return output that inflate still holds (raw deflate loses its last bytes under max_length)https://github.com/RustPython/RustPython/issues/8907#top
#8909https://github.com/RustPython/RustPython/pull/8909
https://github.com/JMLX42
JMLX42https://github.com/JMLX42
on Sep 29, 2026https://github.com/RustPython/RustPython/issues/8907#issue-5633265806
#8752https://github.com/RustPython/RustPython/pull/8752
JMLX42https://github.com/JMLX42
on Oct 14, 2026https://github.com/RustPython/RustPython/issues/8907#event-33204911192
zlib: return output inflate still holds after the last input bytehttps://github.com/JMLX42/RustPython/commit/fbe818de260cf35170433434da91a3bb321b295e
https://docs.github.com/articles/closing-issues-via-commit-messages
fbe818dhttps://github.com/JMLX42/RustPython/commit/fbe818de260cf35170433434da91a3bb321b295e
zlib: return output inflate still holds after the last input bytehttps://github.com/JMLX42/RustPython/commit/8dbcb31e19ca429283dd24dc81a83a07afca803c
https://docs.github.com/articles/closing-issues-via-commit-messages
8dbcb31https://github.com/JMLX42/RustPython/commit/8dbcb31e19ca429283dd24dc81a83a07afca803c
youknowonehttps://github.com/youknowone
completedhttps://github.com/RustPython/RustPython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#8909https://github.com/RustPython/RustPython/pull/8909
on Nov 7, 2026https://github.com/RustPython/RustPython/issues/8907#event-35403290162
youknowonehttps://github.com/youknowone
on Nov 7, 2026https://github.com/RustPython/RustPython/issues/8907#event-35406080641
zlib: return output inflate still holds after the last input byte (Ru…https://github.com/youknowone/RustPython/commit/ea5fbcc00bfa1f26ca1587db996dcd0577b72da6
Ru…https://github.com/RustPython/RustPython/pull/8909
https://docs.github.com/articles/closing-issues-via-commit-messages
ea5fbcchttps://github.com/youknowone/RustPython/commit/ea5fbcc00bfa1f26ca1587db996dcd0577b72da6
Sign up for freehttps://github.com/signup?return_to=https://github.com/RustPython/RustPython/issues/8907
Sign in to commenthttps://github.com/login?return_to=https://github.com/RustPython/RustPython/issues/8907
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.