lib/nbt: Spec extension to allow for different types of top level tags #42

Open
opened 2022-08-15 01:04:28 +02:00 by BodgeMaster · 0 comments

From NBT::helper::validateRawNBTData():

        if (initialPosition >= dataSize) {
            // Yes, this *could* return an instance of ErrorOr with
            // ErrorCodes::OVERRUN but we only care to know if what is
            // at that position is valid NBT which it clearly isn't according
            // to the original spec.
            return false;

            // An interesting question at this point is whether we should
            // consider empty input valid or invalid NBT data.
            //
            // The original spec says that the top-most tag is always a
            // compound (or in more recent times, the Microsoft-commercialized
            // in-game-purchase-enabling version also allows list tags)
            // which automatically means that no data is invalid data...
            // I don't see a reason why having a different tag as the top-most
            // tag shouldn't be valid NBT in which case we have to face the
            // question whether no data is invalid or just empty NBT data.
            //
            // This seems like a reasonable extension to the spec to me and
            // it should be backwards compatible AFAIK.
            //
            // - BodgeMaster
        }
From `NBT::helper::validateRawNBTData()`: ```cpp if (initialPosition >= dataSize) { // Yes, this *could* return an instance of ErrorOr with // ErrorCodes::OVERRUN but we only care to know if what is // at that position is valid NBT which it clearly isn't according // to the original spec. return false; // An interesting question at this point is whether we should // consider empty input valid or invalid NBT data. // // The original spec says that the top-most tag is always a // compound (or in more recent times, the Microsoft-commercialized // in-game-purchase-enabling version also allows list tags) // which automatically means that no data is invalid data... // I don't see a reason why having a different tag as the top-most // tag shouldn't be valid NBT in which case we have to face the // question whether no data is invalid or just empty NBT data. // // This seems like a reasonable extension to the spec to me and // it should be backwards compatible AFAIK. // // - BodgeMaster } ```
BodgeMaster added the
Fix Later
Enhancement
labels 2022-08-15 01:04:28 +02:00
Sign in to join this conversation.
There is no content yet.