Pocketmine-mp: /give allows meta values >32767 even though these cannot be saved

Created on 16 Jun 2017  路  5Comments  路  Source: pmmp/PocketMine-MP

Issue description



Since ShortTags have a(n unsigned max) value of 65535, anyone giving themselves something such as a paper with damage 65535 would cause the server to crash on Player::save(). Giving yourself an item with damage > 65535 isn't possible as PocketMine automatically changes the value to 0. But you can give yourself an item with damage 65535 and it will stop raklib.

Anyone with operator permissions or pocketmine.command.give would technically have the freedom to halt the server.

Steps to reproduce the issue

  1. /give yourself paper:65535
  2. Quit the server

OS and versions

  • PocketMine-MP: eb05f2e
  • PHP: 7.0.19
  • Server OS: Ubuntu 14.04 LTS
  • Game version: Win10 (irrelevant)

Plugins

  • Is the issue reproducible without any plugins loaded?
    Yes

Crashdump, backtrace or other files

Core Fixed

Most helpful comment

This should be capped to signed-short max (32767) as per MCPE.

All 5 comments

This should be capped to signed-short max (32767) as per MCPE.

Yeah, much better!

There is also a degree of undefinedness around the any-damage meta value. PocketMine currently considers it to be -1, but MCPE uses 32767 (signed-short max) (they don't allow negatives anymore since 1.1). I haven't decided how best to resolve this yet.

@dktapps Does that apply to tools too?

It applies to all items. You're bounded to 0-32766 for valid non-special meta values now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HipsterAF picture HipsterAF  路  3Comments

Ox531 picture Ox531  路  3Comments

TheDiamondYT1 picture TheDiamondYT1  路  3Comments

arfianadam picture arfianadam  路  3Comments

XDqrkneZ picture XDqrkneZ  路  3Comments