NationalSecurityAgency/ghidra · error · IllegalArgumentException
Total step count exceeds LONG_MAX
Error message
Total step count exceeds LONG_MAX
What it means
Thrown by AbstractStep.advance(long steps) when the new total tickCount + steps overflows a signed long (detected because the result wrapped to negative). This protects against silent overflow in schedule step counts which are used as execution limits.
Source
Thrown at Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/time/schedule/AbstractStep.java:90
public long getPatchCount() {
return 0;
}
@Override
public abstract AbstractStep clone();
/**
* Add to the count of this step
*
* @param steps the count to add
*/
public void advance(long steps) {
if (steps < 0) {
throw new IllegalArgumentException("Cannot advance a negative number");
}
long newCount = tickCount + steps;
if (newCount < 0) {
throw new IllegalArgumentException("Total step count exceeds LONG_MAX");
}
this.tickCount = newCount;
}
@Override
public long rewind(long steps) {
if (steps < 0) {
throw new IllegalArgumentException("Cannot rewind a negative number");
}
long diff = this.tickCount - steps;
this.tickCount = Long.max(0, diff);
return -diff;
}
@Override
public boolean isCompatible(Step step) {
if (!(step.getClass() == this.getClass())) {
return false;View on GitHub (pinned to d5f144c24d)
Solutions
- Cap the desired step count at Long.MAX_VALUE rather than advancing beyond it.
- Check overflow explicitly before advancing: if (Long.MAX_VALUE - step.getTickCount() < steps) clamp.
- Reconsider why the count is so large; schedules are bounded by real execution time.
Example fix
// before step.advance(hugeDelta); // after long headroom = Long.MAX_VALUE - step.getTickCount(); step.advance(Math.min(hugeDelta, headroom));
Defensive patterns
Strategy: validation
Validate before calling
long headroom = Long.MAX_VALUE - step.getTickCount(); step.advance(Math.min(steps, headroom));
Type guard
static boolean advanceFits(long cur, long add) { return add >= 0 && Long.MAX_VALUE - cur >= add; } Prevention
- Cap aggregate step counts at Long.MAX_VALUE.
- Bound loops that accumulate advances.
- Reconsider any path that approaches Long.MAX_VALUE ticks.
When it happens
Trigger: Calling advance(steps) where tickCount + steps > Long.MAX_VALUE, e.g. repeatedly advancing an already-large step, or passing an extremely large steps value.
Common situations: Aggregating/looping many advances without bounds; parsing an unbounded schedule; test inputs with Long.MAX_VALUE deltas.
Related errors
- Cannot step a negative number
- Cannot advance a negative number
- Cannot rewind a negative number
- Code unit would extend beyond address space
- operandIndex
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/35a7882e55948138.
Report an issue: GitHub.