Skip to content

Fix SDSU ray tracer buffer overflow and modernize Python tests#64

Open
pjmaechling wants to merge 1 commit intoSCECcode:devfrom
pjmaechling:dev
Open

Fix SDSU ray tracer buffer overflow and modernize Python tests#64
pjmaechling wants to merge 1 commit intoSCECcode:devfrom
pjmaechling:dev

Conversation

@pjmaechling
Copy link
Contributor

This PR addresses two compatibility issues when running the BBP on modern operating systems with stricter compilers (e.g., GCC 11, Ubuntu 22.04+).

1. SDSU Ray Tracer Segmentation Fault (ray3DJHfor.c)

  • Issue: The SDSU BBtoolbox.exe binary was crashing with a segmentation fault during the high-frequency scattering generation. Modern GCC compilers flag a string buffer overflow.
  • Fix: The malloc allocations for timefile and velfile on lines 205-206 were originally sized at exactly 12 and 11 bytes, which did not account for the hidden \0 null terminator required by strcpy. This caused memory corruption on strict compilers. Increased the allocation size to 80 bytes and included <stdlib.h> and <unistd.h> to resolve implicit declaration errors.

2. Python Environment Test Failure (test_python_code.py)

  • Issue: The test_python_code_tests unit test was failing with a python: not found error and throwing unknown option errors for -tt. Modern Linux environments often alias to python3 exclusively, and Python 3 natively rejects mixed tabs and spaces, rendering the -tt flag obsolete.
  • Fix: Updated the shell commands in test_execute_platform_bbp, test_python_code_comps, and test_python_code_tests to use sys.executable instead of hardcoded python or python3 strings, ensuring the tests always use the active Python environment. Removed the deprecated -tt flags.

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