Skip to content

Verifier with no file identifier: file identifier must be length4 #8002

Description

@AntonVonDelta

I get the error in the title when verifying the received buffer for a stripped down Monster demo (just a struct and a table).
It is raised because the generated file uses "" for the file identifier instead of null which is passed to the verifier.
Then it enters this logic:

private bool CheckBufferFromStart(string identifier, uint startPos, VerifyTableAction verifyAction)
    {
      if ((identifier != null) &&
          (identifier.Length == 0) &&
          ((verifier_buffer.Length < (SIZE_U_OFFSET + FILE_IDENTIFIER_LENGTH)) || (!BufferHasIdentifier(verifier_buffer, startPos, identifier))))
      {
        return false;
      }
      if(!CheckIndirectOffset(startPos))
      {
        return false;
      }
      uint offset = GetIndirectOffset(startPos);
      return CheckTable(offset, verifyAction); //  && GetComputedSize()
    }

It clearly checks for null.
For model generation i used: --csharp --gen-object-api

Why does this happen?

Flatc version: 23.5.26

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions