Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitise texture item IDs for facades #7905

Open
wants to merge 1 commit into
base: fabric/1.20.1
Choose a base branch
from

Conversation

62832
Copy link
Member

@62832 62832 commented Jun 9, 2024

Fixes an instant crash bug reported by the Prominence 2 modpack devs if a facade has somehow been obtained with a malformed texture item ID.

Comment on lines +209 to +215
ResourceLocation itemId;

try {
itemId = new ResourceLocation(nbt.getString(NBT_ITEM_ID));
} catch (ResourceLocationException e) {
return ItemStack.EMPTY;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@62832 Do you know what the resource-id is that they get crashes for?
I have a hunch it's actually just an empty string since we don't guard against a tag being present, but it not having our proprty... (giving us an empty string)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything malformed with a non A-Z such as minecraft::dirt will cause a crash otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but that is arbitrarily edited NBT which I don't really care about :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can crash half of AE2 if you just corrupt the NBT entirely

Copy link
Member Author

@62832 62832 Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire reason this PR was made is because a large server already reported someone using an exploit to obtain arbitrarily-modified items and cause client crashes for other players, leading to the modpack for this server disabling facades entirely.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you are certain this was not due the item having any NBT?
Because our code actually also crashes if the item has a tag, but the tag is missing or property...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is 100% not the only place we do this:
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't say the item had no NBT at all. This was because the item NBT was present on the facade but the value it actually held was malformed.

shartte added a commit that referenced this pull request Jun 19, 2024
Forge counterpart to #7905.

---------

Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants