On Wed, 11 Dec 2024, LIU Hao wrote:

在 2024-12-11 21:33, Martin Storsjö 写道:

  if (gPEDta)
    {
-      va_rel = gPEDta->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress; -      sz_rel = gPEDta->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size; +      if (gPEDta->OptionalHeader.NumberOfRvaAndSizes > IMAGE_DIRECTORY_ENTRY_BASERELOC)
+        {
+          va_rel = gPEDta- >OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress; +          sz_rel = gPEDta->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
+        }
    }

For these changes, isn't the > comparison wrong? Wouldn't it be enough if we have OptionalHeader.NumberOfRvaAndSizes >= IMAGE_DIRECTORY_ENTRY_BASERELOC?

I think this should be a normal `index < size` pattern, but written backwards as `size > index`. So it's not incorrect, but weird.

Thanks, you're right, sorry for the mixup.

The curiosity about imports being handled only for one of PE and PE+ would be nice to check though.

// Martin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to