diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 15:55:49 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 15:55:49 -0500 |
| commit | 530246a6e7c002a896a9957c7cb199e0b4995fd7 (patch) | |
| tree | 00a7be86fa175bc654fe568296d967b6cc78c6ce /runtime/test/loader_test.cpp | |
| parent | 16d285e7bc175806fba425741788b8594a0a8443 (diff) | |
tests: loader_test fills its byte buffer with uint8_t{0} (C4244 x2 under /W4)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/loader_test.cpp')
| -rw-r--r-- | runtime/test/loader_test.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/test/loader_test.cpp b/runtime/test/loader_test.cpp index b05f35b15..6fd1dced4 100644 --- a/runtime/test/loader_test.cpp +++ b/runtime/test/loader_test.cpp | |||
| @@ -94,7 +94,7 @@ std::filesystem::path write_image_as(const std::vector<uint8_t>& bytes, const st | |||
| 94 | // export directory, which is how a forwarder is encoded. | 94 | // export directory, which is how a forwarder is encoded. |
| 95 | std::vector<uint8_t> make_forwarder_image(const char* target, uint64_t image_base) { | 95 | std::vector<uint8_t> make_forwarder_image(const char* target, uint64_t image_base) { |
| 96 | auto img = make_image(); | 96 | auto img = make_image(); |
| 97 | std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); // real tables end in a zero descriptor | 97 | std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0}); // real tables end in a zero descriptor |
| 98 | nt_of(img)->OptionalHeader.ImageBase = image_base; | 98 | nt_of(img)->OptionalHeader.ImageBase = image_base; |
| 99 | auto* ed = reinterpret_cast<IMAGE_EXPORT_DIRECTORY*>(img.data() + 0x200); | 99 | auto* ed = reinterpret_cast<IMAGE_EXPORT_DIRECTORY*>(img.data() + 0x200); |
| 100 | ed->Base = 1; | 100 | ed->Base = 1; |
| @@ -117,7 +117,7 @@ std::vector<uint8_t> make_forwarder_image(const char* target, uint64_t image_bas | |||
| 117 | // An image importing `dll`!`symbol` by name. | 117 | // An image importing `dll`!`symbol` by name. |
| 118 | std::vector<uint8_t> make_import_image(const char* dll, const char* symbol) { | 118 | std::vector<uint8_t> make_import_image(const char* dll, const char* symbol) { |
| 119 | auto img = make_image(); | 119 | auto img = make_image(); |
| 120 | std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); | 120 | std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0}); |
| 121 | auto* d = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(img.data() + 0x200); | 121 | auto* d = reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>(img.data() + 0x200); |
| 122 | d->Name = 0x1060; // past the zero descriptor that ends the table | 122 | d->Name = 0x1060; // past the zero descriptor that ends the table |
| 123 | d->OriginalFirstThunk = 0x1100; | 123 | d->OriginalFirstThunk = 0x1100; |
| @@ -589,7 +589,7 @@ void test_delay_descriptor_fields() { | |||
| 589 | { | 589 | { |
| 590 | // Without dlattrRva the fields are 32-bit virtual addresses, which cannot address an x64 image. | 590 | // Without dlattrRva the fields are 32-bit virtual addresses, which cannot address an x64 image. |
| 591 | auto img = make_image(); | 591 | auto img = make_image(); |
| 592 | std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); | 592 | std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0}); |
| 593 | auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200); | 593 | auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200); |
| 594 | d->Attributes.AllAttributes = 0; | 594 | d->Attributes.AllAttributes = 0; |
| 595 | d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table | 595 | d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table |
| @@ -603,7 +603,7 @@ void test_delay_descriptor_fields() { | |||
| 603 | { | 603 | { |
| 604 | const char* what = "a delay import with no name table binds through its address table"; | 604 | const char* what = "a delay import with no name table binds through its address table"; |
| 605 | auto img = make_image(); | 605 | auto img = make_image(); |
| 606 | std::fill(img.begin() + 0x200, img.begin() + 0x400, 0); | 606 | std::fill(img.begin() + 0x200, img.begin() + 0x400, uint8_t{0}); |
| 607 | auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200); | 607 | auto* d = reinterpret_cast<IMAGE_DELAYLOAD_DESCRIPTOR*>(img.data() + 0x200); |
| 608 | d->Attributes.AllAttributes = 1; // dlattrRva | 608 | d->Attributes.AllAttributes = 1; // dlattrRva |
| 609 | d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table | 609 | d->DllNameRVA = 0x1060; // past the zero descriptor that ends the table |