Disallow deleting SYMTAB and its elements (#43)
This commit is contained in:
parent
fabf9efece
commit
ae99b752af
5
FIXES
5
FIXES
|
@ -25,6 +25,11 @@ THIS SOFTWARE.
|
||||||
This file lists all bug fixes, changes, etc., made since the AWK book
|
This file lists all bug fixes, changes, etc., made since the AWK book
|
||||||
was sent to the printers in August, 1987.
|
was sent to the printers in August, 1987.
|
||||||
|
|
||||||
|
June 17, 2019:
|
||||||
|
Disallow deleting SYMTAB and its elements, which creates
|
||||||
|
use-after-free bugs. Thanks to GitHub user Cody Mello (melloc)
|
||||||
|
for the fix. (Merged from PR #43.)
|
||||||
|
|
||||||
June 5, 2019:
|
June 5, 2019:
|
||||||
Allow unmatched right parenthesis in a regular expression to
|
Allow unmatched right parenthesis in a regular expression to
|
||||||
be treated literally. Fixes Issue #40. Thanks to GitHub user
|
be treated literally. Fixes Issue #40. Thanks to GitHub user
|
||||||
|
|
1
awk.h
1
awk.h
|
@ -105,6 +105,7 @@ extern Cell *rsloc; /* RS */
|
||||||
extern Cell *rstartloc; /* RSTART */
|
extern Cell *rstartloc; /* RSTART */
|
||||||
extern Cell *rlengthloc; /* RLENGTH */
|
extern Cell *rlengthloc; /* RLENGTH */
|
||||||
extern Cell *subseploc; /* SUBSEP */
|
extern Cell *subseploc; /* SUBSEP */
|
||||||
|
extern Cell *symtabloc; /* SYMTAB */
|
||||||
|
|
||||||
/* Cell.tval values: */
|
/* Cell.tval values: */
|
||||||
#define NUM 01 /* number value is valid */
|
#define NUM 01 /* number value is valid */
|
||||||
|
|
2
main.c
2
main.c
|
@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
const char *version = "version 20190605";
|
const char *version = "version 20190617";
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
3
run.c
3
run.c
|
@ -512,6 +512,9 @@ Cell *awkdelete(Node **a, int n) /* a[0] is symtab, a[1] is list of subscripts *
|
||||||
int nsub;
|
int nsub;
|
||||||
|
|
||||||
x = execute(a[0]); /* Cell* for symbol table */
|
x = execute(a[0]); /* Cell* for symbol table */
|
||||||
|
if (x == symtabloc) {
|
||||||
|
FATAL("cannot delete SYMTAB or its elements");
|
||||||
|
}
|
||||||
if (!isarr(x))
|
if (!isarr(x))
|
||||||
return True;
|
return True;
|
||||||
if (a[1] == 0) { /* delete the elements, not the table */
|
if (a[1] == 0) { /* delete the elements, not the table */
|
||||||
|
|
Loading…
Reference in New Issue