Skip to content

Prevent buffer overflow in type array allocation #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented Aug 7, 2025

This commit adds bounds checking to add_type and increase MAX_TYPES to 128, fixing memory corruption during stage-1 compilation when typedef count exceeds limit.

Summary by Bito

This pull request fixes a critical bug by increasing the maximum number of types from 64 to 128, preventing buffer overflow during type array allocation. It also adds bounds checking in the add_type function to avoid memory corruption during stage-1 compilation, enhancing the stability of the type management system.

This commit adds bounds checking to add_type and increase MAX_TYPES to
128, fixing memory corruption during stage-1 compilation when typedef
count exceeds limit.
Copy link
Collaborator

@ChAoSUnItY ChAoSUnItY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've cherry picked this patch and confirmed it was caused by insufficient buffer capacity, which fixes #226.

@jserv jserv merged commit 396a595 into master Aug 7, 2025
12 checks passed
@jserv jserv deleted the fix-regression branch August 7, 2025 06:55
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.

2 participants