Browse Source

v2.20pl1

Patch level 1 release by Jon B. Volkoff,
                              15 March 1996

LIST OF PATCHES TO 2.20:

bwb_cnd.c

   Moved init routine for bwb_while so that it would be initialized regardless
   of expression value, not just if TRUE.  This was causing some segmentation
   faults in WHILE-WEND loops.

bwb_elx.c

   Plugged gaping memory leak.  Temp variable space for expression evaluation
   was being allocated but not freed when done (oops!).

bwb_fnc.c

   Added check for NULL return from getenv to prevent segmentation faults.

bwbasic.h
   Revised VERSION define to reflect above changes.

To implement these patches simply replace the old versions of the above source
files with the new ones and remake bwbasic.
tags/v2.20pl1
Jon Foster 2 years ago
parent
commit
8db1549589
5 changed files with 104 additions and 12 deletions
  1. +40
    -0
      README.patch01
  2. +14
    -7
      bwb_cnd.c
  3. +42
    -3
      bwb_elx.c
  4. +7
    -1
      bwb_fnc.c
  5. +1
    -1
      bwbasic.h

+ 40
- 0
README.patch01 View File

@@ -0,0 +1,40 @@


README.patch01 file for


Bywater BASIC Interpreter/Shell, version 2.20
---------------------------------------------

Copyright (c) 1993, Ted A. Campbell
for bwBASIC version 2.10, 11 October 1993

Version 2.20 modifications by Jon B. Volkoff,
25 November 1995

Patch level 1 release by Jon B. Volkoff,
15 March 1996


LIST OF PATCHES TO 2.20:

bwb_cnd.c

Moved init routine for bwb_while so that it would be initialized regardless
of expression value, not just if TRUE. This was causing some segmentation
faults in WHILE-WEND loops.

bwb_elx.c

Plugged gaping memory leak. Temp variable space for expression evaluation
was being allocated but not freed when done (oops!).

bwb_fnc.c

Added check for NULL return from getenv to prevent segmentation faults.

bwbasic.h
Revised VERSION define to reflect above changes.

To implement these patches simply replace the old versions of the above source
files with the new ones and remake bwbasic.

+ 14
- 7
bwb_cnd.c View File

@@ -1451,13 +1451,6 @@ bwb_while( l )
struct exp_ese *e;
struct bwb_line *r;

/* call bwb_exp() to interpret the expression */

e = bwb_exp( l->buffer, FALSE, &( l->position ) );

if ( (int) exp_getnval( e ) == TRUE )
{

/* if this is the first time at this WHILE statement, note it */

if ( CURTASK excs[ CURTASK exsc ].while_line != l )
@@ -1502,6 +1495,20 @@ bwb_while( l )
}
#endif

/*----------------------------------------------------*/
/* Expression evaluation was at the top of bwb_while, */
/* and the init portion was performed only if TRUE. */
/* The init routine should be performed regardless of */
/* expression value, else a segmentation fault can */
/* occur! (JBV) */
/*----------------------------------------------------*/

/* call bwb_exp() to interpret the expression */

e = bwb_exp( l->buffer, FALSE, &( l->position ) );

if ( (int) exp_getnval( e ) == TRUE )
{
bwb_setexec( l, l->position, EXEC_WHILE );
return bwb_zline( l );
}


+ 42
- 3
bwb_elx.c View File

@@ -736,6 +736,7 @@ exp_function( expression )
/* struct bwb_variable argv[ MAX_FARGS ]; */ /* Removed by JBV */
struct bwb_variable *argv; /* Added by JBV */
bstring *b;
register int i, j; /* JBV */
#if INTENSIVE_DEBUG
char tbuf[ MAXSTRINGSIZE + 1 ];

@@ -1047,6 +1048,47 @@ exp_function( expression )
/* (some other less fortunate routine may need it) */
/* JBV, 10/95 */
/*-------------------------------------------------*/

/* First kleanup the joint (JBV) */
for ( i = 0; i < n_args; ++i )
{
if ( argv[ i ].memnum != NULL )
{
/* Revised to FREE pass-thru call by JBV */
FREE(argv[ i ].memnum, "exp_function");
argv[ i ].memnum = NULL;
}
if ( argv[ i ].memstr != NULL )
{
/* Remember to deallocate those far-flung branches! (JBV) */
for ( j = 0; j < (int) argv[ i ].array_units; ++j )
{
if ( argv[ i ].memstr[ j ].sbuffer != NULL )
{
/* Revised to FREE pass-thru call by JBV */
FREE( argv[ i ].memstr[ j ].sbuffer, "exp_function" );
argv[ i ].memstr[ j ].sbuffer = NULL;
}
argv[ i ].memstr[ j ].rab = FALSE;
argv[ i ].memstr[ j ].length = 0;
}
/* Revised to FREE pass-thru call by JBV */
FREE( argv[ i ].memstr, "exp_function" );
argv[ i ].memstr = NULL;
}
/* Revised to FREE pass-thru calls by JBV */
if (argv[ i ].array_sizes != NULL)
{
FREE( argv[ i ].array_sizes, "exp_function" );
argv[ i ].array_sizes = NULL; /* JBV */
}
if (argv[ i ].array_pos != NULL)
{
FREE( argv[ i ].array_pos, "exp_function" );
argv[ i ].array_pos = NULL; /* JBV */
}
}

FREE( argv, "exp_function" );

#if INTENSIVE_DEBUG
@@ -1220,6 +1262,3 @@ exp_variable( expression )
return TRUE;

}




+ 7
- 1
bwb_fnc.c View File

@@ -1433,7 +1433,13 @@ fnc_environ( argc, argv, unique_id )

/* call getenv() then write value to string */

strcpy( tmp, getenv( tbuf ));
/*--------------------------------------------------------------------*/
/* Added check for getenv return value to prevent segmentation faults */
/* JBV 3/15/96 */
/*--------------------------------------------------------------------*/
if (getenv( tbuf ) != NULL) strcpy( tmp, getenv( tbuf ));
else strcpy( tmp, "" );

str_ctob( var_findsval( &nvar, nvar.array_pos ), tmp );

/* return address of nvar */


+ 1
- 1
bwbasic.h View File

@@ -41,7 +41,7 @@

/* Version number */

#define VERSION "2.20" /* Current version number */
#define VERSION "2.20 patch level 1" /* Current version number */

/***************************************************************



Loading…
Cancel
Save