Chew / JDA-Chewtils

Chew's fork of JDA-Applications/JDA-Utilities, with support for modern features such as Slash Commands, Context Menus, and more.
https://chew.pro/JDA-Chewtils
Apache License 2.0
73 stars 24 forks source link

Fix IndexOutOfBounds #74

Closed Sanduhr32 closed 2 years ago

Sanduhr32 commented 2 years ago

Pull Request

Pull Request Checklist

Please follow the following steps before opening this PR.
PRs that do not complete the checklist will be subject to denial for missing information.

Pull Request Information

Check and fill in the blanks for all that apply:

Description

fixes an index out of bounds when trying to make message parts, when the raw message is a bot mention only. Edit: line 903 or 917 would fail either way if the index is beyond rawLength

  1. substring(start, end) https://github.com/openjdk/jdk17/blob/master/src/java.base/share/classes/java/lang/String.java#L2704 (calls point 2)
  2. ("checkIndices") https://github.com/openjdk/jdk17/blob/master/src/java.base/share/classes/java/lang/String.java#L4599-L4604
Chew commented 2 years ago

I could swear this was fixed or was reported or something. That's why I haven't replied yet since I don't remember 😂

Chew commented 2 years ago

Ah it's just #60 / #61

Sanduhr32 commented 2 years ago

/shrug that seemed todo a lot that isn't required.

Chew commented 2 years ago

This seems more like a band-aid fix, I want to test some other methods to see what the root issue is. Will investigate.

Sanduhr32 commented 2 years ago

It overscans the full message string, if it's just the mention as the commands prefix

GameKuchen commented 5 months ago

I'm still having issues with this error getting dropped? Any news on this?