Skip to content

Commit 1f1b06b

Browse files
authored
Merge pull request #64 from pjmaechling/dev
Fix SDSU ray tracer buffer overflow and modernize Python tests
2 parents 0740014 + 3b5a081 commit 1f1b06b

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

bbp/src/sdsu/bbtoolbox/ray3DJHfor.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ if I don't answer the e-mail (our computers are in a state of flux). */
8989
#include <math.h>
9090
#include <fcntl.h>
9191
#include <string.h>
92+
#include <stdlib.h>
93+
#include <unistd.h>
9294

9395
#define PI 3.141592654
9496
#define SQR2 1.414213562
@@ -202,8 +204,8 @@ void raytracing_(hypo,grid,step,PS_flag)
202204
/*timefile[80], file in which travel times appear at the end */
203205
wallfile[80]; /* file containing input wall values of traveltimes */
204206

205-
char *velfile=malloc(11);
206-
char *timefile=malloc(12);
207+
char *velfile=malloc(80);
208+
char *timefile=malloc(80);
207209
FILE *vfint, *tfint;
208210

209211
/* ARRAY TO ORDER SIDE FOR SOLUTION IN THE RIGHT ORDER */
@@ -1701,7 +1703,7 @@ void raytracing_(hypo,grid,step,PS_flag)
17011703

17021704
/* -------------------------------------------------------------------------- */
17031705

1704-
compar(a,b)
1706+
int compar(a,b)
17051707
struct sorted *a, *b;
17061708
{
17071709
if(a->time > b->time) return(1);

bbp/tests/test_python_code.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,29 @@ def test_execute_platform_bbp(self):
5252
Run Broadband Plotform to make sure we can start it
5353
"""
5454
self.install = InstallCfg()
55-
cmd = ("python3 %s -v >/dev/null" %
56-
(os.path.join(self.install.A_COMP_DIR,
57-
"run_bbp.py")))
55+
cmd = ("%s %s -v >/dev/null" %
56+
(sys.executable, os.path.join(self.install.A_COMP_DIR,
57+
"run_bbp.py")))
5858
self.assertFalse(bband_utils.runprog(cmd, False) != 0,
5959
"Cannot start Broadband plotform!")
6060

6161
def test_python_code_comps(self):
6262
"""
63-
Run Python with -tt flag to detect mix of tabs and spaces in the code
63+
Run Python compileall to detect mix of tabs and spaces in the code
6464
"""
6565
self.install = InstallCfg()
66-
cmd = ("python3 -tt -m compileall -f -q -l %s" %
67-
(self.install.A_COMP_DIR))
66+
cmd = ("%s -m compileall -f -q -l %s" %
67+
(sys.executable, self.install.A_COMP_DIR))
6868
self.assertFalse(bband_utils.runprog(cmd, False) != 0,
6969
"Python code in comps directory mixes tabs and spaces!")
7070

7171
def test_python_code_tests(self):
7272
"""
73-
Run Python with -tt flag to detect mix of tabs and spaces in the code
73+
Run Python compileall to detect mix of tabs and spaces in the code
7474
"""
7575
self.install = InstallCfg()
76-
cmd = ("python -tt -m compileall -f -q -l %s" %
77-
(self.install.A_TEST_DIR))
76+
cmd = ("%s -m compileall -f -q -l %s" %
77+
(sys.executable, self.install.A_TEST_DIR))
7878
self.assertFalse(bband_utils.runprog(cmd, False) != 0,
7979
"Python code in test directory mixes tabs and spaces!")
8080

0 commit comments

Comments
 (0)