From 24935f654f6df700a9a062298258b9485f584502 Mon Sep 17 00:00:00 2001 From: Romain Thomas Date: Mon, 12 Sep 2022 07:10:18 +0200 Subject: [PATCH] Fix #784 --- src/MachO/Binary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MachO/Binary.cpp b/src/MachO/Binary.cpp index 95f35bb27a..f0504ef448 100644 --- a/src/MachO/Binary.cpp +++ b/src/MachO/Binary.cpp @@ -540,7 +540,7 @@ const SegmentCommand* Binary::segment_from_offset(uint64_t offset) const { } auto it = offset_seg_.lower_bound(offset); - if (it->first == offset || it == it_begin) { + if (it != std::end(offset_seg_) && (it->first == offset || it == it_begin)) { SegmentCommand* seg = it->second; if (seg->file_offset() <= offset && offset < (seg->file_offset() + seg->file_size())) { return seg;