ClassicDIY / ModbusTool

A modbus master and slave test tool with import and export functionality, supports TCP, UDP and RTU.
Apache License 2.0
673 stars 201 forks source link

Throw exception when request has wrong quantity #32

Open kalwinskidawid opened 1 year ago

kalwinskidawid commented 1 year ago

Hey, I found a bug. When you try send request eg. with huge quantity then program will throw exception:

Application: ModbusSlave.exe Architecture version: v4.0.30319 Description: the process was 
aborted due to an unhandled exception. Exception information: 
System.OverflowException w 
ModbusLib.Protocols.ModbusCodecReadMultipleRegisters.ServerDecode(ModbusLib.Protocols.ModbusCommand, 
ModbusLib.ByteArrayReader) w 
ModbusLib.Protocols.ModbusTcpCodec.ModbusLib.Protocols.IProtocolCodec.ServerDecode(ModbusLib.CommDataBase) 
w ModbusLib.TcpServer.Worker() w 
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, 
System.Threading.ContextCallback, System.Object, Boolean) w 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, 
System.Threading.ContextCallback, System.Object, Boolean) w 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, 
System.Threading.ContextCallback, System.Object) w 
System.Threading.ThreadHelper.ThreadStart()

Example request 000100000006010363c09c85