Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crash in helper.py when program outputs null bytes #39

Merged
merged 1 commit into from
Oct 5, 2024

Conversation

XavierCooney
Copy link
Contributor

If the program being tested outputs a null byte to stdout autotest crashes with

Traceback (most recent call last):
  File "/usr/local/share/autotest/autotest.py", line 41, in main
    sys.exit(run_autotest())
             ^^^^^^^^^^^^^^
  File "/usr/local/share/autotest/autotest.py", line 111, in run_autotest
    run_helper(tests, parameters, args)
  File "/usr/local/extrafiles/share/autotest/helper.py", line 56, in run_helper
    os.environ["HELPER_" + k.upper()] = v
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 685, in __setitem__
ValueError: embedded null byte

This is because the stdout of the program is passed to the helper via an environment variable, which does not permit embedding null bytes. Similar issues occur with the stdin/stderr/expected_stdout/source.

This PR replaces the null bytes with \x00, which I assume the LLM can still make sense of.

@abiramen abiramen merged commit e85a4d4 into COMP1511UNSW:main Oct 5, 2024
2 of 5 checks passed
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.

2 participants