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/ior.go | |
| 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/ior.go')
| -rw-r--r-- | internal/ior.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/ior.go b/internal/ior.go index 6e8111a..433484d 100644 --- a/internal/ior.go +++ b/internal/ior.go @@ -341,10 +341,12 @@ func applyTraceScopeFromGlobalFilter(cfg *flags.Config, filter globalfilter.Filt cfg.PidFilter = -1 cfg.TidFilter = -1 if pid, ok := filter.PID.EqValue(); ok { - cfg.PidFilter = pid + // EqValue returns int64; PID values are always within int range (Linux PID_MAX ≤ 4194304). + cfg.PidFilter = int(pid) } if tid, ok := filter.TID.EqValue(); ok { - cfg.TidFilter = tid + // EqValue returns int64; TID values are always within int range (Linux PID_MAX ≤ 4194304). + cfg.TidFilter = int(tid) } } |
