Skip to content

🐛 Guard DD slab allocation sizes against overflow - #2841

Merged
burgholzer merged 1 commit into
mainfrom
fix/dd-slab-overflow
Oct 25, 2026
Merged

burgholzer merged 1 commit into
mainfrom
fix/dd-slab-overflow

Conversation

@burgholzer

@burgholzer burgholzer commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Reject DD slab sizes that overflow size_t with std::bad_alloc before allocating. The initial allocation checks entry count against the representable byte size. Growth checks the previous slab's byte size before multiplying and derives the new entry count from it.

An overflowing initial count previously wrapped to a small allocation and was accepted. The new regression reproduces that defect without allocating a large slab. This is a standalone extraction from the native verifier work and has no verifier dependency.

Validation on Linux:

  • The new regression fails on unmodified main because no exception is thrown.
  • All 218 DD tests pass, including existing growth, reuse, reset and statistics checks.
  • Repository lint and whole-file C++ lint pass with zero findings across both changed files.
  • The commit is signed and its signature verified.

Hosted CI and human review remain pending. GPT-6 via Codex assisted implementation, validation and this description.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

🤖 *AI text below* 🤖

Reject initial slab counts that would wrap the byte size. Check growth
using the previous slab's byte size before multiplying, then derive its
entry count. Unrepresentable allocations throw std::bad_alloc without
changing the allocator API.

The regression accepts an overflowing count on main and rejects it with
this guard. Existing tests retain growth, reuse and reset coverage.

Assisted-by: GPT-6 via Codex
@burgholzer burgholzer added fix Fix for something that isn't working DD Anything related to the DD package c++ Anything related to C++ code labels Oct 25, 2026
@burgholzer burgholzer self-assigned this Oct 25, 2026
@burgholzer burgholzer added this to the v4.2.0 - SC26 milestone Oct 25, 2026
@burgholzer
burgholzer enabled auto-merge (squash) October 25, 2026 13:50
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/dd/MemoryManager.cpp 90.0% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer
burgholzer merged commit 848b05d into main Oct 25, 2026
25 checks passed
@burgholzer
burgholzer deleted the fix/dd-slab-overflow branch October 25, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code DD Anything related to the DD package fix Fix for something that isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant