MinecraftDev icon indicating copy to clipboard operation
MinecraftDev copied to clipboard

Apache 2.0 LICENSE file detected as NBT

Open jpenilla opened this issue 1 year ago • 2 comments
trafficstars

Minecraft Development for IntelliJ plugin version

2023.3-1.7.3

IntelliJ version

IntelliJ IDEA 2023.3.6 (Ultimate Edition) Build #IU-233.15026.9, built on March 20, 2024

Operating System

macOS 14.4

Target platform

No response

Description of the bug

Apache 2.0 LICENSE files often get detected as NBT files and need to have the file type manually overridden to plain text. Screenshot 2024-03-21 at 9 58 46 PM Screenshot 2024-03-21 at 9 58 55 PM

jpenilla avatar Mar 22 '24 04:03 jpenilla

The license file has no file extension so mcdev then checks to see if the first 10kb of the file can be interpreted as NBT. The first byte of the Apache 2.0 license is 10 (newline) if you are using unix line endings, which coincidentally is the same as the compound tag ID, which is what is required at the top level of the NBT. I can imagine that from here it's quite easy to produce text files that look like valid NBT for the first 10kb, because the next step is to read the next two bytes as a big-endian length for a string to read.

Earthcomputer avatar Mar 22 '24 11:03 Earthcomputer

Now all we have to do is make an NBT polyglot license...

sylv256 avatar Mar 22 '24 23:03 sylv256