Skip to content

Commit

Permalink
Some more bug fixes around relocations.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkinsella committed Jun 7, 2016
1 parent 9bf893c commit 006dc36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Src/Workshell.PE/Content/Relocation/RelocationTableContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ private void LoadRelocations(LocationCalculator calc, Stream stream, ulong image
{
IMAGE_BASE_RELOCATION base_reloc = Utils.Read<IMAGE_BASE_RELOCATION>(stream);

block_offset += sizeof(ulong);
block_size += sizeof(ulong);

long count = (base_reloc.SizeOfBlock - 8) / 2;
long count = (base_reloc.SizeOfBlock - sizeof(ulong)) / sizeof(ushort);
List<ushort> relocs = new List<ushort>();

for(long i = 0; i < count; i++)
Expand All @@ -55,7 +54,6 @@ private void LoadRelocations(LocationCalculator calc, Stream stream, ulong image

relocs.Add(reloc);

block_offset += sizeof(ushort);
block_size += sizeof(ushort);
}

Expand All @@ -65,6 +63,9 @@ private void LoadRelocations(LocationCalculator calc, Stream stream, ulong image

if (block_size >= DataDirectory.Size)
break;

block_offset += sizeof(ulong);
block_offset += sizeof(ushort) * (uint)count;
}

relocations = new RelocationBlocks(this,location,block_relocs,imageBase);
Expand Down

0 comments on commit 006dc36

Please sign in to comment.