Skip to content

🐛 fix(css): bound unclosed function fallback - #1641

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/fuzz-css-memory-20261106
Nov 6, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/fuzz-css-memory-20261106

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

An unmatched function at the CSS nesting limit used the token count as an index, reading one past the token array. The resulting uninitialized length raised MemoryError in the CSS stylesheet fuzzer.

Use the final token when the function reaches the end of input. Include a trailing dimension unit and close blocks in the copied raw function, so the output stays balanced and stable on a second minification pass.

Checks

  • tox run -e dev -x env.dev.deps= -x env.dev.dependency_groups=test
  • .tox/dev/bin/python -m pytest -q tests/css/minify/test_css.py (4,680 passed, 63 skipped)
  • tox run -e 3.14 (73,041 passed, 1,277 skipped; 100% C line and branch coverage)
  • tox run -e warnings
  • UBSan/Atheris Python 3.11 replay of the original and minimized private reports through the fuzz callback
  • ruff format --check, ruff check, and clang-format --dry-run --Werror on changed files

@gaborbernat
gaborbernat force-pushed the fix/fuzz-css-memory-20261106 branch from 7fd5967 to 04f6112 Compare November 6, 2026 18:05
@gaborbernat
gaborbernat force-pushed the fix/fuzz-css-memory-20261106 branch from 04f6112 to e9d1032 Compare November 6, 2026 18:07
@gaborbernat gaborbernat changed the title Fix unclosed CSS functions at nesting limit 🐛 fix(css): bound unclosed function fallback Nov 6, 2026
@gaborbernat gaborbernat added the bug Something isn't working label Nov 6, 2026
@codspeed

codspeed Bot commented Nov 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 582 untouched benchmarks
⏩ 32 skipped benchmarks1


Comparing gaborbernat:fix/fuzz-css-memory-20261106 (e9d1032) with main (e0cb89b)

Open in CodSpeed

Footnotes

  1. 32 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@gaborbernat
gaborbernat enabled auto-merge (squash) November 6, 2026 18:38
@gaborbernat
gaborbernat merged commit f5f3385 into tox-dev:main Nov 6, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant