@@ -193,23 +193,23 @@ void ParseImageSections(
193
193
194
194
namespace Orc {
195
195
196
- PeParser::PeParser (std::shared_ptr< ByteStream> stream, std::error_code& ec)
197
- : m_stream(std::move( stream) )
196
+ PeParser::PeParser (ByteStream& stream, std::error_code& ec)
197
+ : m_stream(stream)
198
198
{
199
- ::ParseImageDosHeader (* m_stream, m_imageDosHeader, ec);
199
+ ::ParseImageDosHeader (m_stream, m_imageDosHeader, ec);
200
200
if (ec)
201
201
{
202
202
return ;
203
203
}
204
204
205
205
::ParseImageNtHeader (
206
- * m_stream, m_imageDosHeader, m_imageNtHeader, m_imageOptionalHeaders32, m_imageOptionalHeaders64, ec);
206
+ m_stream, m_imageDosHeader, m_imageNtHeader, m_imageOptionalHeaders32, m_imageOptionalHeaders64, ec);
207
207
if (ec)
208
208
{
209
209
return ;
210
210
}
211
211
212
- ::ParseImageSections (* m_stream, m_imageNtHeader, m_imageSectionsHeaders, ec);
212
+ ::ParseImageSections (m_stream, m_imageNtHeader, m_imageSectionsHeaders, ec);
213
213
if (ec)
214
214
{
215
215
return ;
@@ -313,7 +313,7 @@ void PeParser::ReadDirectory(uint8_t index, std::vector<uint8_t>& buffer, std::e
313
313
}
314
314
315
315
buffer.resize (directory.Size );
316
- ReadChunkAt (* m_stream, directory.VirtualAddress , buffer, ec);
316
+ ReadChunkAt (m_stream, directory.VirtualAddress , buffer, ec);
317
317
if (ec)
318
318
{
319
319
Log::Debug (" Failed to read directory (index: {}) [{}]" , index , ec);
@@ -403,7 +403,7 @@ void PeParser::GetHashedChunks(PeChunks& chunks, std::error_code& ec) const
403
403
}
404
404
405
405
chunks[3 ].offset = GetSizeOfOptionalHeaders ();
406
- chunks[3 ].length = m_stream-> GetSize () - chunks[3 ].offset - secdir.Size ;
406
+ chunks[3 ].length = m_stream. GetSize () - chunks[3 ].offset - secdir.Size ;
407
407
}
408
408
409
409
void PeParser::Hash (CryptoHashStreamAlgorithm algorithms, const PeChunks& chunks, PeHash& output, std::error_code& ec)
@@ -418,7 +418,7 @@ void PeParser::Hash(CryptoHashStreamAlgorithm algorithms, const PeChunks& chunks
418
418
return ;
419
419
}
420
420
421
- const auto written = ::CopyChunks (chunks, * m_stream, *hashstream, ec);
421
+ const auto written = ::CopyChunks (chunks, m_stream, *hashstream, ec);
422
422
if (ec)
423
423
{
424
424
Log::Debug (" Failed to hash chunks [{}]" , ec);
@@ -427,7 +427,7 @@ void PeParser::Hash(CryptoHashStreamAlgorithm algorithms, const PeChunks& chunks
427
427
428
428
// MS does zero padding for PEs that are not 8 modulo (often with catalogs)
429
429
const uint8_t padding[8 ] = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
430
- const auto alignment = m_stream-> GetSize () % sizeof (padding);
430
+ const auto alignment = m_stream. GetSize () % sizeof (padding);
431
431
if (alignment != 0 )
432
432
{
433
433
const auto paddingLength = sizeof (padding) - alignment;
0 commit comments