Skip to content

Escape NUL bytes in white diff admin text. - #1726

Merged
veluca93 merged 1 commit into
cms-dev:mainfrom
HyperSoWeak:fix/whitediff-nul-byte
Oct 5, 2026
Merged

veluca93 merged 1 commit into
cms-dev:mainfrom
HyperSoWeak:fix/whitediff-nul-byte

Conversation

@HyperSoWeak

Copy link
Copy Markdown
Contributor

NUL is valid UTF-8, so backslashreplace leaves it as-is in the white diff
admin_text. PostgreSQL rejects NUL in text columns, so writing the
evaluation fails, and EvaluationService retries it forever, leaving the
testcase unscored. Triggered by a contestant printing a NUL byte on a
mismatching line (e.g. uninitialized memory) in a Batch task with the
built-in diff.

The fix escapes NUL as \x00 instead of stripping it, so the difference
stays visible.

Regression from b98e44b, not in any release. Similar to #888. Hit this in
production during an exam.

NUL is valid UTF-8, so decoding with backslashreplace keeps it as-is.
PostgreSQL rejects NUL in text columns, so writing the evaluation fails
and EvaluationService retries it forever, leaving the testcase
unscored. Escape it as \x00, consistent with how backslashreplace
renders invalid bytes, so the admin can still see the difference.
@veluca93
veluca93 merged commit 1914a5a into cms-dev:main Oct 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants