Import scanners read resolved addresses as names when the import name table is missing

Aberta
#76 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
Meio dia
Facilidade para iniciantes
62/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
cpp

Direção de pesquisa

Start with the import walk in clean/rr_f/proxy/src/hook_dll.cpp around lines 849-861, where names come from OriginalFirstThunk with a FirstThunk fallback, then check the same pattern in clean/rr_f/proxy/src/setupapi_identity.cpp near line 390. The proposed fix is to skip a descriptor whose OriginalFirstThunk is zero and log once. Done means a synthetic PE64 test with a zero OriginalFirstThunk asserts nothing is patched and nothing faults, and the scanner must first be exported or compiled into the test.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area: ray-reconstruction bug

This was found by reading the code. It has not been reproduced.

What happens

The import scanner in clean/rr_f/proxy/src/hook_dll.cpp:853-861 reads names from OriginalFirstThunk, and falls back to FirstThunk when it is zero. It then dereferences base + names->u1.AddressOfData as an IMAGE_IMPORT_BY_NAME. At run time FirstThunk holds resolved absolute addresses. The ordinal check passes (the top bit is clear for user-mode addresses). The result is base + address, which is unmapped, so the read faults.

The scanner runs on every loaded module (hook_dll.cpp:1105-1115). Only descriptors whose DLL name equals the interface file name reach the walk (hook_dll.cpp:849). There is no __try around do_hook.

The same fallback and interpretation is in clean/rr_f/proxy/src/setupapi_identity.cpp:390. That scanner only runs for Spider-Man2.exe.

When it can happen

Only for a module that imports the game interface (or, for the SetupAPI scanner, a Spider-Man2.exe that imports SetupAPI) and was linked or packed without an import name table. Current MSVC and LLVM x64 linkers always emit one. This is old-Borland or packer territory. No known RR game qualifies. Low severity: a crash at load if it ever occurs.

To do

  • In both scanners: if (!OriginalFirstThunk) { log once; continue; }.
  • Optionally bounds-check each name RVA against SizeOfImage.
  • Caution: none in practice. A module without an import name table is simply not patched, and that is logged.

Test

CPU-only. Build a synthetic in-memory PE64 image: DOS and NT headers, one import descriptor naming the interface, OriginalFirstThunk = 0, FirstThunk filled with a real function address. Call the scanner (it needs to be exported to the test or compiled into it). Assert nothing is patched and nothing crashes.

Linguagem predominante
C++
Estrelas
12
Forks
2
Merge médio
3h 10min
PRs com merge (30d)
171

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de phantoslayer21/wronggpu

Todas as issues de phantoslayer21/wronggpu

Issues semelhantes

Mais issues de C++

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.