From b49e722c0b9e9d93f79ae0e3e0b2856cee105c42 Mon Sep 17 00:00:00 2001 From: Frank Cui Date: Tue, 3 Dec 2019 16:00:58 +1100 Subject: [PATCH] revid/config.go: define max value for MinFrames --- revid/config/config.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/revid/config/config.go b/revid/config/config.go index a2ab47c6..e7728554 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -327,11 +327,15 @@ func (c *Config) Validate() error { c.BurstPeriod = defaultBurstPeriod } - if c.MinFrames == 0 { + const maxMinFrames = 1000 + switch { + case c.MinFrames == 0: c.Logger.Log(logger.Info, pkg+"no min period defined, defaulting", "MinFrames", defaultMinFrames) c.MinFrames = defaultMinFrames - } else if c.MinFrames < 0 { + case c.MinFrames < 0: return errors.New("refresh period is less than 0") + case c.MinFrames > maxMinFrames: + return errors.New("refresh period is greater than 1000") } if c.FrameRate <= 0 {