diff options
| author | Per Larsson <[email protected]> | 2021-09-16 21:19:14 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-16 21:19:14 +0200 |
| commit | cae9f697a13840eb87cb9f6fc32eb80e3a65b29a (patch) | |
| tree | 721af351316d5a1fe2ac022fad2a4e9017b043ae /zenhttp/httpshared.cpp | |
| parent | zcache - minor cleanup. (diff) | |
| parent | Merge branch 'main' of https://github.com/EpicGames/zen (diff) | |
| download | zen-cae9f697a13840eb87cb9f6fc32eb80e3a65b29a.tar.xz zen-cae9f697a13840eb87cb9f6fc32eb80e3a65b29a.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenhttp/httpshared.cpp')
| -rw-r--r-- | zenhttp/httpshared.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/zenhttp/httpshared.cpp b/zenhttp/httpshared.cpp index 2dbf95959..b0c5493db 100644 --- a/zenhttp/httpshared.cpp +++ b/zenhttp/httpshared.cpp @@ -123,23 +123,22 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint MemoryInStream InStream(Payload); BinaryReader Reader(InStream); - CbPackage Package; - CbPackageHeader Hdr; Reader.Read(&Hdr, sizeof Hdr); if (Hdr.HeaderMagic != kCbPkgMagic) { - // report error - return {}; + throw std::runtime_error("invalid CbPackage header magic"); } - uint32_t ChunkCount = Hdr.AttachmentCount + 1; + const uint32_t ChunkCount = Hdr.AttachmentCount + 1; std::unique_ptr<CbAttachmentEntry[]> AttachmentEntries{new CbAttachmentEntry[ChunkCount]}; Reader.Read(AttachmentEntries.get(), sizeof(CbAttachmentEntry) * ChunkCount); + CbPackage Package; + for (uint32_t i = 0; i < ChunkCount; ++i) { const CbAttachmentEntry& Entry = AttachmentEntries[i]; |