1
0
Fork 0
cuberite-2a/src/UI
Tiger Wang 49ef21d650 MultiVersionProtocol: fix two crashes
First one: add missing exception handler in ProcessProtocolIn

Second: remove faulty logic dealing with incomplete packets.

`a_Data = a_Data.substr(m_Buffer.GetUsedSpace() - m_Buffer.GetReadableSpace());`

was incorrect; it attempted to apply a length derived from m_Buffer to an unrelated a_Data. Its purpose was to give cProtocol the data the client sent, minus initial handshake bytes. However, we can use the knowledge that during initial handshake, there is no encryption and every byte can be written unchanged into m_Buffer, to just call cProtocol with a data length of zero. This will cause it to parse from m_Buffer - wherein we have already written everything the client sent - with no a_Data manipulation needed.

Additionally, removed UnsupportedButPingableProtocolException (use of exception as control flow) and encode this state as m_Protocol == nullptr, id est "no protocol for this unsupported version", which is then handled by cMultiVersionProtocol itself.
2021-01-19 09:54:58 +00:00
..
AnvilWindow.cpp cWindow: Convert XYZ to Vector3 (#4764) 2020-07-04 23:49:17 +02:00
AnvilWindow.h cWindow: Convert XYZ to Vector3 (#4764) 2020-07-04 23:49:17 +02:00
BeaconWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
BeaconWindow.h Using Super. 2020-04-16 20:07:48 +00:00
BrewingstandWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
BrewingstandWindow.h Using Super. 2020-04-16 20:07:48 +00:00
CMakeLists.txt Upgrade to C++17 [CMake] (#4717) 2020-05-16 20:59:10 +01:00
ChestWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
ChestWindow.h Using Super. 2020-04-16 20:07:48 +00:00
CraftingWindow.cpp Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00
CraftingWindow.h Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00
DropSpenserWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
DropSpenserWindow.h Using Super. 2020-04-16 20:07:48 +00:00
EnchantingWindow.cpp Remove SetProperty(...cPlayer) 2020-10-03 16:54:14 +01:00
EnchantingWindow.h Remove SetProperty(...cPlayer) 2020-10-03 16:54:14 +01:00
EnderChestWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
EnderChestWindow.h Using Super. 2020-04-16 20:07:48 +00:00
FurnaceWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
FurnaceWindow.h Using Super. 2020-04-16 20:07:48 +00:00
HopperWindow.cpp Using Super. 2020-04-16 20:07:48 +00:00
HopperWindow.h Using Super. 2020-04-16 20:07:48 +00:00
HorseWindow.cpp Force all headers other than "Globals.h" to be included with relative paths (#4269) 2018-08-29 01:51:25 +01:00
HorseWindow.h Implement horse inventory (#4053) 2017-10-21 17:56:09 +01:00
InventoryWindow.cpp Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00
InventoryWindow.h Introduce recipe book functionality (#4493) 2020-07-14 17:56:42 +01:00
MinecartWithChestWindow.h Using Super. 2020-04-16 20:07:48 +00:00
SlotArea.cpp MultiVersionProtocol: fix two crashes 2021-01-19 09:54:58 +00:00
SlotArea.h Remove SetProperty(...cPlayer) 2020-10-03 16:54:14 +01:00
Window.cpp Fix potential destruction crashes (#5095) 2021-01-02 13:50:34 +00:00
Window.h Remove SetProperty(...cPlayer) 2020-10-03 16:54:14 +01:00
WindowOwner.h Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00