Skip to content

Add bounds checking for hash table insertion#94

Open
startergo wants to merge 3 commits into
openglonmetal:mainfrom
startergo:main
Open

Add bounds checking for hash table insertion#94
startergo wants to merge 3 commits into
openglonmetal:mainfrom
startergo:main

Conversation

@startergo
Copy link
Copy Markdown
Contributor

Added bounds checking for hash table insertion to prevent exceeding table size.

Added bounds checking for hash table insertion to prevent exceeding table size.
Copilot AI review requested due to automatic review settings January 13, 2026 17:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds bounds checking to the insertHashElement function to handle edge cases where the hash table cannot be resized to accommodate the requested name (e.g., when the table size would overflow or allocation fails).

Changes:

  • Added bounds check after the resize loop to verify that the name is within table bounds before insertion
  • Added error message to stderr when insertion fails due to exceeding table size

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MGL/src/hash_table.m Outdated
Comment thread MGL/src/hash_table.m
startergo and others added 2 commits January 13, 2026 12:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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