Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Feb 15, 2025
1 parent c000b17 commit 6761851
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions include/LIEF/PE/ResourcesManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ class LIEF_API ResourcesManager : public Object {
{}

ResourcesManager(const ResourcesManager& other) :
Object(other),
resources_(other.resources_)
// Skip (on purpose) the `dialogs_` cache
{}

ResourcesManager& operator=(const ResourcesManager& other) {
if (&other != this) {
Object::operator=(other);
resources_ = other.resources_;
// Skip (on purpose) the `dialogs_` cache
}
Expand Down
1 change: 0 additions & 1 deletion src/ELF/Parser.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ namespace LIEF {
namespace ELF {
template<typename ELF_T>
ok_error_t Parser::parse_binary() {
using Elf_Off = typename ELF_T::Elf_Off;

LIEF_DEBUG("Start parsing");
// Parse header
Expand Down
16 changes: 8 additions & 8 deletions src/PE/Parser.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ok_error_t Parser::parse_nested_relocated() {
class RelocatedStream : public BinaryStream {
public:
RelocatedStream(Parser& parent) :
parent_(parent)
parent_(&parent)
{}

~RelocatedStream() override = default;
Expand All @@ -116,17 +116,17 @@ ok_error_t Parser::parse_nested_relocated() {
RelocatedStream& operator=(RelocatedStream&& other) noexcept = default;

uint64_t size() const override {
return parent_.stream_->size();
return parent_->stream_->size();
}

ok_error_t peek_in(void* dst, uint64_t offset, uint64_t size,
uint64_t va = 0) const override {
auto it_value = parent_.dyn_hdr_relocs_.lower_bound(offset);
if (it_value == parent_.dyn_hdr_relocs_.end()) {
return parent_.stream_->peek_in(dst, offset, size, va);
auto it_value = parent_->dyn_hdr_relocs_.lower_bound(offset);
if (it_value == parent_->dyn_hdr_relocs_.end()) {
return parent_->stream_->peek_in(dst, offset, size, va);
}

auto is_ok = parent_.stream_->peek_in(dst, offset, size, va);
auto is_ok = parent_->stream_->peek_in(dst, offset, size, va);
if (!is_ok) {
return make_error_code(is_ok.error());
}
Expand All @@ -140,7 +140,7 @@ ok_error_t Parser::parse_nested_relocated() {
return ok();
}

auto upper_bound = parent_.dyn_hdr_relocs_.upper_bound(offset + size);
auto upper_bound = parent_->dyn_hdr_relocs_.upper_bound(offset + size);
for (; it_value != upper_bound; ++it_value) {
int64_t delta_offset = (int64_t)it_value->first - (int64_t)offset;
assert(delta_offset >= 0);
Expand All @@ -164,7 +164,7 @@ ok_error_t Parser::parse_nested_relocated() {
}

private:
Parser& parent_;
Parser* parent_ = nullptr;
};

if (!config_.parse_arm64x_binary || dyn_hdr_relocs_.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/PE/resources/ResourceIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ result<ResourceIcon> ResourceIcon::from_serialization(const uint8_t* buffer, siz
std::vector<uint8_t> pixels;
stream.read_data(pixels, pixel_size);
icon.pixels(std::move(pixels));
return std::move(icon);
return icon;
}

std::vector<uint8_t> ResourceIcon::serialize() const {
Expand Down

0 comments on commit 6761851

Please sign in to comment.