mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Add check for big/small number in integer conversion
This commit is contained in:
parent
2d33f550b2
commit
b2a6588ad5
1 changed files with 4 additions and 0 deletions
|
|
@ -197,6 +197,10 @@ function tolongint(what)
|
|||
traceError(TRACE_ERROR, TRACE_CONSOLE, "Trying to convert inf to integer")
|
||||
traceError(TRACE_ERROR, TRACE_CONSOLE, debug.traceback())
|
||||
return("0")
|
||||
elseif((what >= math.maxinteger) or (what <= math.mininteger)) then
|
||||
traceError(TRACE_ERROR, TRACE_CONSOLE, "Number out of integers range: " .. what)
|
||||
traceError(TRACE_ERROR, TRACE_CONSOLE, debug.traceback())
|
||||
return("0")
|
||||
else
|
||||
return(string.format("%u", math.floor(what)))
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue