Skip to content

Fix: Add assertion for n_ticks minimum when labels provided#677

Open
brenocq wants to merge 1 commit intomasterfrom
fix/setup-axis-ticks
Open

Fix: Add assertion for n_ticks minimum when labels provided#677
brenocq wants to merge 1 commit intomasterfrom
fix/setup-axis-ticks

Conversation

@brenocq
Copy link
Collaborator

@brenocq brenocq commented Feb 16, 2026

Fixes #600

Problem
When calling SetupAxisTicks(axis, v_min, v_max, n_ticks, labels) with n_ticks = 1 and a single-element labels array, the function:

  1. Increases n_ticks to 2 (minimum requirement)
  2. Accesses labels[1] which is out of bounds
  3. Causes undefined behavior / potential crash in strlen()

Solution
Added assertion that validates when custom labels are provided, n_ticks must be at least 2.

@brenocq brenocq self-assigned this Feb 16, 2026
@brenocq brenocq added type:fix Something isn't working prio:low Low priority status:review The task is under review labels Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio:low Low priority status:review The task is under review type:fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling SetupAxisTicks with a single label will cause strlen to be called on undefined memory

1 participant