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

Criterion names in advancement selector argument limited to unquoted strings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.13.2, Minecraft 18w47a, Minecraft 19w09a, Minecraft 19w11b, Minecraft 19w12a, Minecraft 19w12b, Minecraft 19w13a, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, Minecraft 1.14 Pre-Release 5, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3 Pre-Release 3
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      In entity selectors, the advancement selector has support for testing that certain criteria are set or unset. When parsing the selector, these can only be parsed successfully if they are made up of a limited subset of characters.

      How to reproduce

      Attempt to run either of the following two commands:

      /execute if entity @s[advancements={minecraft:adventure/adventuring_time={"minecraft:bamboo_jungle_hills"=true}}]
      /execute if entity @s[advancements={minecraft:adventure/adventuring_time={minecraft:bamboo_jungle_hills=true}}]
      

      Expected behavior

      There should not be a parsing error. For example, the following the following similar command parses successfully.

      /execute if entity @s[advancements={minecraft:adventure/ol_betsy={shot_crossbow=true}}]
      

      Actual behavior

      There is a parsing error (Expected "=")

      Code analysis

      Based on MC version 18w47a, decompiled with CFR version 131.

      The bug is in ea.java, soon after the string "advancements" is used (this is one of only four references to the string "advancements" in the entire codebase decompiled from the client jar). The following is an excerpt from the second (nested in the first) while loop:

      while (stringReader.canRead() && stringReader.peek() != '}') {
          stringReader.skipWhitespace();
          String string = stringReader.readUnquotedString();
          stringReader.skipWhitespace();
          stringReader.expect('=');
          stringReader.skipWhitespace();
          // <...>
      }
      

      To fix this bug, the third line should call StringReader::readString as opposed to the current StringReader::readUnquotedString, which would support quoted strings and hence a wider array of the supported characters.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              montz13 Levertion
            • Votes:
              9 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: