Skip to content

guard against overflow in AllocInst buffer growth#626

Open
jmestwa-coder wants to merge 1 commit intogoogle:mainfrom
jmestwa-coder:allocinst-overflow-guard
Open

guard against overflow in AllocInst buffer growth#626
jmestwa-coder wants to merge 1 commit intogoogle:mainfrom
jmestwa-coder:allocinst-overflow-guard

Conversation

@jmestwa-coder
Copy link
Copy Markdown

Summary

Guard against overflow in Compiler::AllocInst buffer growth.

Change

  • Stop doubling when cap approaches max_ninst_
  • Cap growth at max_ninst_ to keep allocation within bounds

Why

The previous loop:

while (ninst_ + n > cap)
cap *= 2;

can overflow or exceed intended limits for large inputs. This makes growth bounded and predictable.

Impact

  • Safer handling of large/complex regex compilation
  • No change in behavior for normal cases

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