[Bug] Preserve and classify RIP-relative data and code references
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp, linux
- Domain
- reverse-engineering
Research direction
Start in src/analysis/analysis.cpp around lines 292-300, where every RIP-relative memory operand is tagged as data, then read src/decompiler/project.cpp lines 174-232 and 282-299 to see how referenced objects are emitted. Add regression coverage for a code pointer to main, an initialized scalar like int g = 42, and a short non-printable object, and check that none becomes a zeroed global or an undefined extern. Done means the three cases classify and render correctly, or emit an explicit unsupported marker.
Written by the indexing model from the issue text.
Description
Summary
RIP-relative references are all classified as data xrefs, and the project renderer only preserves a narrow subset of data as strings. This misclassifies code pointers and loses scalar/raw data contents in the generated source.
Evidence
src/analysis/analysis.cpp:292-300 labels every RIP-relative memory operand as "data" without checking whether the target is executable or a discovered function. src/decompiler/project.cpp:174-232 only extracts printable NUL-terminated strings; other data is emitted as zero-initialized storage or an external byte array at :282-299.
Observed cases:
- Normal ELF startup code contains a RIP-relative address of
main. The recovered project declares a synthetic object such asglobal_<main-address>in the.textrange instead of representing a code/function-pointer reference. - For
int g = 42;, the generated data section containsstatic uintptr_t g = 0, so the initialized value is lost. - Referenced non-printable data is emitted as
extern unsigned char name[]without embedding the bytes, despite the output header describing the file as self-contained.
Impact
Generated code can point at fabricated globals, discard initialized state, fail to link because referenced data is undefined, or behave differently when a code address is passed through a register. These failures are independent of instruction-level expression recovery.
Expected behavior
The analysis should distinguish data, code addresses, and function-pointer references. The project renderer should preserve referenced bytes or typed values when it claims to generate self-contained output; if exact reconstruction is impossible, it should emit an explicit unsupported artifact rather than silently zeroing or inventing storage.
Acceptance criteria
- RIP-relative targets in executable sections or discovered functions are not emitted as data objects.
- Initialized scalar and raw referenced data are represented without silently replacing their contents with zero.
- Generated code does not contain undefined
externdata solely because a referenced object was non-printable. - Add regression coverage for a code pointer, an initialized scalar, and a short/non-printable object.
- Dominant language
- C++
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TiElixir/caraxes
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 12/100
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
bug good first issue
Difficulty 3/5 Half a day Newbie friendliness 68/100
All issues in TiElixir/caraxes
Similar issues
-
std::fdim drops partial derivative w.r.t second argument in forward and reverse modePossibly taken @ADITYASINGH1206 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
vgvassilev/clad#2534 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
HAP.cpp fixOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100