Skip to content

Validate compressed A2S responses with unsigned CRC32 - #495

Open
Mirochill wants to merge 1 commit into
ValvePython:masterfrom
Mirochill:fix-unsigned-a2s-checksum
Open

Mirochill wants to merge 1 commit into
ValvePython:masterfrom
Mirochill:fix-unsigned-a2s-checksum

Conversation

@Mirochill

Copy link
Copy Markdown

Valid compressed A2S responses are rejected whenever their CRC32 has its high bit set. The wire checksum is unpacked as a signed integer, while Python 3 returns an unsigned CRC32. A valid rules response therefore raises a checksum mismatch instead of returning the server rules.

Read the checksum as an unsigned 32-bit value and normalize the computed CRC32 to the same bit pattern. This also accommodates the signed crc32 result returned by Python 2. Keep the existing decompressed-size and corruption checks.

Validation:

  • The public a2s_rules regression fails on upstream for a valid compressed rules packet with CRC32 0xf6863c57.
  • Five new cases pass: high-bit and low-bit checksums, a simulated signed Python 2 result, a corrupt checksum and an incorrect decompressed size. All seven game-server tests also pass on Python 3.12.14.
  • The complete Makefile test command with coverage passes all 87 tests on supported Python 3.9.25, versus 82 passing tests on the unmodified baseline. Existing VCR cassettes replay offline with proxy variables removed only from the test process.
  • Pylint for the changed production file reports the same 45 existing diagnostics on both revisions, with no new diagnostic. The optional all-source Pylint command was stopped after over two minutes processing unchanged generated protobufs.
  • git diff --check passes.

No live Steam server was contacted. Other compressed packet-layout variants and the remaining interpreter/platform matrix are outside this focused checksum fix.

AI assistance: implementation and regression tests were prepared with OpenAI Codex and have passed an independent code and regression-test review before submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant