Skip to content

[Possible Bug] Unneeded subtraction by 1 when zeroing remaining bytes #477

@bob80905

Description

@bob80905

In DX/Device.cpp:1136, this code can be seen:

memcpy(ResDataPtr, ResData.get(), R.size());
      // Zero any remaining bytes
      if (R.size() < CBVSize) {
        void *ExtraData = static_cast<char *>(ResDataPtr) + R.size();
        memset(ExtraData, 0, CBVSize - R.size() - 1);
      }

I don't see why the -1 is necessary. The final byte should also be zeroed out.
This hasn't manifested into a crash or incorrect results or anything, but the -1 doesn't seem to have a good reason to exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions