Uploaded image for project: 'Minecraft'
  1. Minecraft
  2. MC-70873

Write variant long in PacketDataSerializer doesn't work properly

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.8
    • Fix Version/s: Minecraft 15w45a
    • Labels:
      None
    • Environment:

      doesn't matter

    • Confirmation Status:
      Unconfirmed

      Description

      I dug into the minecraft source and found out that in the class PacketDataSerializer (Obfuscated class name: hd) the method writeVarLong (Obfuscated method name: public void b(long paramLong)) is using the same bitmask as the write variant int method (bitmask: 0xFFFFFF80) (Obfuscated method name: public void b(int paramInt)) but because a long has 64 bit in java this bitmask has to be (0xFFFFFFFFFFFFFF80l)

      current source in 1.8
        public void b(long paramLong)
        {
          for ( ; ; )
          {
            if ((paramLong & 0xFFFFFF80) == 0L)
            {
              writeByte((int)paramLong);
              return;
            }
            writeByte((int)(paramLong & 0x7F) | 0x80);
            paramLong >>>= 7;
          }
        }
      
      Solution
        public void b(long paramLong)
        {
          for ( ; ; )
          {
            if ((paramLong & 0xFFFFFFFFFFFFFF80l) == 0L)
            {
              writeByte((int)paramLong);
              return;
            }
            writeByte((int)(paramLong & 0x7F) | 0x80);
            paramLong >>>= 7;
          }
        }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              makeo Manuel
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: