Skip to content

Commit

Permalink
Ensure header hash is correctly persisted to context in table create …
Browse files Browse the repository at this point in the history
…mode.
  • Loading branch information
tpn committed Jan 3, 2023
1 parent 2f8cb1b commit ee91729
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/PerfectHash/PerfectHashContextTableCreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,23 @@ Return Value:
Context->TableCreateCsvFile = File;
File->Vtbl->AddRef(File);

//
// Capture the header hash in the context.
//

Context->HexHeaderHash.Length = sizeof(Context->HexHeaderHashBuffer);
Context->HexHeaderHash.MaximumLength = Context->HexHeaderHash.Length;
ASSERT(Context->HexHeaderHash.Length >= HexHash.Length - 1);

ZeroMemory(&Context->HexHeaderHashBuffer, Context->HexHeaderHash.Length);
CopyMemory(Context->HexHeaderHashBuffer,
HexHash.Buffer + 1,
HexHash.Length - 1);

Context->HexHeaderHash.Buffer = (PCHAR)&Context->HexHeaderHashBuffer;
Context->HexHeaderHash.Length =
(USHORT)strlen(Context->HexHeaderHash.Buffer);

//
// We're done, finish up.
//
Expand Down

0 comments on commit ee91729

Please sign in to comment.