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

fix: Resolve issue with book & quills on lectern contraptions #7276

Open
wants to merge 2 commits into
base: mc1.20.1/dev
Choose a base branch
from

Conversation

itisluiz
Copy link

Resolves #7253. Where an attempt to parse JSON out of a writable book (not a written book), which has raw string data for the pages array caused a game crash.

Compound tags for a written book on a lectern:
{Book:{Count:1b,id:"minecraft:written_book",tag:{author:"Dev",filtered_title:"aa",pages:['{"text":"aaaa"}','{"text":"bbbb"}'],resolved:1b,title:"aa"}},Page:0,id:"minecraft:lectern"}

Compound tags for a writable book on a lectern:
{Book:{Count:1b,id:"minecraft:writable_book",tag:{pages:["cccc","ddddd"]}},Page:0,id:"minecraft:lectern"}

An attempt to parse "cccc" as JSON caused the crash.

Resolves Creators-of-Create#7253. Where an attempt to parse JSON out of a writable book (not a written book), which has raw string data for the pages array caused a game crash.
@itisluiz itisluiz marked this pull request as draft January 12, 2025 14:22
@itisluiz
Copy link
Author

Drafting this because I will do some further testing, I might have found some other issues.

@IThundxr IThundxr added pr type: fix PR fixes a bug pr flag: simple PR has minimal changes labels Jan 13, 2025
Instead of checking if the book has an author, check if it specifically is a writable book by id
@itisluiz itisluiz marked this pull request as ready for review January 14, 2025 00:23
@itisluiz
Copy link
Author

Went and looked at why things were being done the way they were and it is all about sanitizing nbts that could be exploited, so I changed the check to explicitly check for the writable book which is causing the crash as opposed to letting any books without an author tag through since it is a security matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr flag: simple PR has minimal changes pr type: fix PR fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lectern with a written book on it crashes the game when placed by a contraption.
2 participants