skeeto / skeeto/skeeto.github.com

bug in fat pointer bit hack

Open
#9 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
86
Forks
15
PR merge metrics
No merged PRs in 30d

Description

via: https://nullprogram.com/blog/2019/06/30/

// NOTE: x86-64 only!
unsigned char buf[1000];
uintptr addr = (uintptr_t)buf & 0xffffffffffff;
uintptr pack = (sizeof(buf) << 48) | p;
void *fatptr = (void *)pack;

What is p in the above? Also, maybe UINTPTR_MAX is nicer than the constant?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked nullprogram article and the C snippet quoted in this issue. Identify what p should refer to and verify whether UINTPTR_MAX is an appropriate replacement for the hexadecimal mask; the issue is done when the published snippet is corrected and remains valid for its stated x86-64 scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.