Storage Drawers: Forestry Pack

Storage Drawers: Forestry Pack

6M Downloads

[bug]Integer overflow in the drawer with creative storage upgrade

Forever-178 opened this issue ยท 4 comments

commented

Item count overflows in the drawer with creative storage upgrade when insert items which count closing to Integer maximum value in the drawer.

Environment:
Minecraft version: 1.21
Mod loader: NeoForge 21.0.167
Mod List:

  • Storage Drawers-neoforge-1.21-13.8.3
  • Mekanism-1.21-10.6.7.54

Step to reproduce:

  1. Use this command to generate a drawer that item count closes to integer maximum.
    /setblock ~ ~ ~ storagedrawers:oak_full_drawers_1[facing=north]{Drawers:[{Count:2147483646,Item:{Count:1b,id:"minecraft:grass_block"}}],Upgrades:[{Count:1b,Slot:0b,id:"storagedrawers:creative_storage_upgrade"}]}
  2. Use advance logistical transporter insert grass block to this drawer. (Do not use hopper to insert item. It only send 1 item at once.)
  3. Item count will overflow.
commented

I read the source code of 1.12. I think the problem may lie here. Forever-178@2631e4c
I haven't conducted detailed tests for various edge cases, but it works fine in the tests mentioned above.

commented

Could you backport this fix to 1.12 ?

commented

Thanks for pointing out the prior commit. Must have missed copying that to the newer versions. Will be fixed in the next release.

commented

I've released a fix for 1.12, along with 1.20+