mirror of
https://github.com/ivuorinen/gibidify.git
synced 2026-02-01 12:43:50 +00:00
Add overflow checks before converting uint64 memory values to int64 to prevent potential integer overflow issues identified by gosec (G115). - Add math.MaxInt64 checks in fileproc/backpressure.go - Add math.MaxInt64 checks in fileproc/resource_monitor_validation.go - Add math.MaxInt64 checks in fileproc/resource_monitor_metrics.go - Add math.MaxInt64 check in benchmark/benchmark.go with nosec annotation Co-authored-by: ivuorinen <11024+ivuorinen@users.noreply.github.com>
23 lines
546 B
Go
23 lines
546 B
Go
package fileproc
|
|
|
|
// IsEmergencyStopActive returns whether emergency stop is active.
|
|
func (rm *ResourceMonitor) IsEmergencyStopActive() bool {
|
|
rm.mu.RLock()
|
|
defer rm.mu.RUnlock()
|
|
return rm.emergencyStopRequested
|
|
}
|
|
|
|
// IsDegradationActive returns whether degradation mode is active.
|
|
func (rm *ResourceMonitor) IsDegradationActive() bool {
|
|
rm.mu.RLock()
|
|
defer rm.mu.RUnlock()
|
|
return rm.degradationActive
|
|
}
|
|
|
|
// Close cleans up the resource monitor.
|
|
func (rm *ResourceMonitor) Close() {
|
|
if rm.rateLimiter != nil {
|
|
rm.rateLimiter.Stop()
|
|
}
|
|
}
|