Affects Version/s: Minecraft 1.9.4, Minecraft 1.10
Fix Version/s: Minecraft 1.10.1
Environment:Windows 7 Java 8 64 bit
If the chat key is bound to a unicode char, opening the creative inventory GUI and pressing a key causes java.lang.IndexOutOfBoundsException
I expect that pressing the chat button opens the inventory filter field to allow me to type
what happens instead is pressing any key (not just the chat key) causes an immediate crash.
Steps to Reproduce:
- bind chat to a unicode char (non US keyboard needed, or edit options.txt to include the line "key_key.chat:427")
- load a creative world
- open your inventory
- press any key
Code explanation for this follows.
Using MCP names, undoubtedly different from the names used in the code internally. Sorry. Obfuscation
This happens due to GuiContainerCreative.keyTyped(char, int) calling GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)
That method is as follows:
keyBindChat.getKeyCode() in my instance is 427. Point being it is something greater than 256.
Keyboard.isKeyDown(int) method is as follows:
keyDownBuffer was created so:
where KEYBOARD_SIZE is defined as 256.
so keyDownBuffer.get(427) of course causes IndexOutOfBoundsException