Skip to content

Clean up lookahead-related code#3

Open
tomerqodo wants to merge 7 commits intocodex_full_base_clean_up_lookahead-related_code_pr3from
codex_full_head_clean_up_lookahead-related_code_pr3
Open

Clean up lookahead-related code#3
tomerqodo wants to merge 7 commits intocodex_full_base_clean_up_lookahead-related_code_pr3from
codex_full_head_clean_up_lookahead-related_code_pr3

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#3

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfae1193e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cluster.c
Comment on lines +1112 to 1114
for (int j = 0; j <= keys_result->numkeys; j++) {
robj *this_key = argv[keys_result->keys[j].pos];
int this_slot = (int)keyHashSlot((char*)this_key->ptr, sdslen(this_key->ptr));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fix off-by-one in slot iteration

The loop iterates with j <= keys_result->numkeys, which means when j == numkeys it reads keys_result->keys[numkeys] and writes slot_buffer[numkeys]. Both are one past the allocated bounds (the arrays are sized for numkeys elements), so any command with at least one key can trigger out-of-bounds memory access and crashes or memory corruption. The condition should be < keys_result->numkeys.

Useful? React with 👍 / 👎.

Comment thread src/cluster.c
Comment on lines +1109 to +1111
/* Allocate temporary buffer for slot tracking */
int *slot_buffer = malloc(sizeof(int) * keys_result->numkeys);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use zmalloc/zfree for temporary buffers

Repo root AGENTS.md rule #2 requires using zmalloc/zfree instead of malloc/free. This new malloc-allocated slot_buffer (and later free) bypasses Redis memory tracking and violates the repository’s allocator policy, which can lead to incorrect memory accounting and inconsistent behavior with allocator hooks. Replace with zmalloc/zfree (or remove the buffer if unnecessary).

Useful? React with 👍 / 👎.

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