diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-13 14:31:42 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-13 14:31:42 +0300 |
| commit | 21ed685fb7e64c4dc36250c67832d594fc119307 (patch) | |
| tree | 2ca07dba12a1908045240afe037027617a87474e /internal/tui | |
| parent | a73b7973531f2b8632269a8c8359acf69ee61f45 (diff) | |
fix: avoid int64->int truncation in NumericFilter.EqValue on 32-bit arch
EqValue() previously returned int, silently truncating int64 values that
exceed math.MaxInt32 on 32-bit architectures. Change the return type to
int64 and update callers (ior.go, filterstack.go) with explicit int()
casts that are safe because Linux PID/TID values never exceed 4194304.
Add TestEqValueReturnsInt64PreservesLargeValues to guard the fix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/tui')
| -rw-r--r-- | internal/tui/filterstack.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/tui/filterstack.go b/internal/tui/filterstack.go index 28667d9..b60f322 100644 --- a/internal/tui/filterstack.go +++ b/internal/tui/filterstack.go @@ -87,15 +87,17 @@ func (f *filterStack) rebindProcessFilters(pid, tid int) { // pidFromFilter extracts the PID equality value from the active filter. // Returns -1 (meaning "no filter") when no equality constraint is set. func (f *filterStack) pidFromFilter() int { + // EqValue returns int64; PID values are always within int range (Linux PID_MAX ≤ 4194304). pid, _ := f.global.PID.EqValue() - return selectedPIDFilter(pid) + return selectedPIDFilter(int(pid)) } // tidFromFilter extracts the TID equality value from the active filter. // Returns -1 (meaning "no filter") when no equality constraint is set. func (f *filterStack) tidFromFilter() int { + // EqValue returns int64; TID values are always within int range (Linux PID_MAX ≤ 4194304). tid, _ := f.global.TID.EqValue() - return selectedPIDFilter(tid) + return selectedPIDFilter(int(tid)) } // labelStack returns the current human-readable filter label stack (read-only). |
