Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arithmetic operation resulted in an overflow

When i send:

Result = CInt(NetApiBufferFree(pBuffer))

I receive (SOME TIMES) this error:

Arithmetic operation resulted in an overflow.

What exactly means that? and how i can resolve it?

like image 453
Lefteris Gkinis Avatar asked Dec 12 '22 17:12

Lefteris Gkinis


1 Answers

It means that CInt argument is out of range of Integer, -0x80000000 to 0x7FFFFFFF And it happens when NetApiBufferFree returns an error: error codes are bigger than 0x80000000.

There is no unsigned int32 type, so use CLng instead of CInt.


About source of error. You should find out code of error which you get: call MsgBox or log it to file, or use breakpoint. Next find its description. If it won't help you (for example error would be E_FAIL), add code to check that pBuffer value is valid - that it wasn't modified by something, and wasn't already freed. Add logging for NetApiBuffer* calls.

like image 193
Abyx Avatar answered Jan 16 '23 09:01

Abyx