ValveSoftware / ValveSoftware/source-sdk-2013

bf_read::ReadSignedVarInt64 Incorrect intermediate type

Open Beginner friendly
#322 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10k
Forks
3k
Avg merge
8d 11h
Merged PRs (30d)
2

Description

https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/tier1/bitbuf.cpp#L1067

In bf_read::ReadSignedVarInt64, the encoded value is read into a uint32, which should be a uint64. This looks like a copy paste bug.

Current:

int64 bf_read::ReadSignedVarInt64()
{
    uint32 value = ReadVarInt64();
    return bitbuf::ZigZagDecode64( value );
}

Fixed:

int64 bf_read::ReadSignedVarInt64()
{
    uint64 value = ReadVarInt64();
    return bitbuf::ZigZagDecode64( value );
}

Contributor guide

Open the contributing guide

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

Open src/tier1/bitbuf.cpp at bf_read::ReadSignedVarInt64 and compare the intermediate type with ReadVarInt64 and bitbuf::ZigZagDecode64. Done means the encoded value is held in the 64-bit type shown in the issue, preserving the intended signed 64-bit decoding.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.