summaryrefslogtreecommitdiffstats
path: root/courgette
diff options
context:
space:
mode:
Diffstat (limited to 'courgette')
-rw-r--r--courgette/image_info.cc10
-rw-r--r--courgette/image_info.h3
2 files changed, 8 insertions, 5 deletions
diff --git a/courgette/image_info.cc b/courgette/image_info.cc
index 5651f36..ed42f12 100644
--- a/courgette/image_info.cc
+++ b/courgette/image_info.cc
@@ -58,10 +58,12 @@ const Section* PEInfo::FindNextSection(uint32 fileOffset) const {
const Section* best = 0;
for (int i = 0; i < number_of_sections_; i++) {
const Section* section = &sections_[i];
- if (fileOffset <= section->file_offset_of_raw_data) {
- if (best == 0 ||
- section->file_offset_of_raw_data < best->file_offset_of_raw_data) {
- best = section;
+ if (section->size_of_raw_data > 0) { // i.e. has data in file.
+ if (fileOffset <= section->file_offset_of_raw_data) {
+ if (best == 0 ||
+ section->file_offset_of_raw_data < best->file_offset_of_raw_data) {
+ best = section;
+ }
}
}
}
diff --git a/courgette/image_info.h b/courgette/image_info.h
index 53a0be7..17936e1 100644
--- a/courgette/image_info.h
+++ b/courgette/image_info.h
@@ -119,7 +119,8 @@ class PEInfo {
return start_ + offset;
}
- // Finds the first section at file_offset or above.
+ // Finds the first section at file_offset or above. Does not return sections
+ // that have no raw bytes in the file.
const Section* FindNextSection(uint32 file_offset) const;
// Returns Section containing the relative virtual address, or NULL if none.
const Section* RVAToSection(RVA rva) const;