Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-254228

Client data generator crashes due to locale-dependent String.format

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 1.19, 1.19.1 Pre-release 4
    • 1.19.1 Pre-release 5
    • None
    • Plausible
    • Crash

    Description

      Steps to Reproduce

      1. Set system locale to Persian
      2. Download 1.19 client jar and libraries
      3. Put the jars in a folder
      4. Run java -Xmx1G -cp "*" net.minecraft.data.Main --client on the folder
      5. Observe the crash

      Code analysis
      using Yarn 1.19

      In net.minecraft.data.client.ItemModelGenerator and BlockStateModelGenerator, String.format is used without passing locales:

      register(compass, String.format("_%02d", new Object[] { Integer.valueOf(i) }), Models.GENERATED);
      

      This is incorrect because the formatted number depends on the OS locale and might not be ASCII numerals if the OS locale is, say, Persian. The value is then passed to Identifier constructor which rejects non-ASCII values, causing a crash (like in MC-225853 )

      Attachments

        Activity

          People

            Unassigned Unassigned
            apple502j apple502j
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              CHK: