From 876de7c25a017ac4e3c7e67b0bdcf5cfe9b1a2a3 Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Wed, 23 Jan 2019 14:12:08 +0000 Subject: [PATCH] Disable writing to 'last','last2','last3','time','memory_allocated' --- lib/init.g | 1 - src/gap.c | 10 +++++++--- src/scanner.c | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/init.g b/lib/init.g index 1111cdf4a79..52dc473f3db 100644 --- a/lib/init.g +++ b/lib/init.g @@ -95,7 +95,6 @@ Ignore := function ( arg ) end; ## SetFilterObj := "2b defined"; infinity := "2b defined"; -last:="2b defined"; ############################################################################# diff --git a/src/gap.c b/src/gap.c index f9517077c5f..532a667875d 100644 --- a/src/gap.c +++ b/src/gap.c @@ -1616,7 +1616,7 @@ static Int PostRestore ( StructInitInfo * module ) { /* construct the `ViewObj' variable */ - ViewObjGVar = GVarName( "ViewObj" ); + ViewObjGVar = GVarName( "ViewObj" ); /* construct the last and time variables */ Last = GVarName( "last" ); @@ -1624,8 +1624,12 @@ static Int PostRestore ( Last3 = GVarName( "last3" ); Time = GVarName( "time" ); MemoryAllocated = GVarName( "memory_allocated" ); - AssGVar_NoReadOnlyCheck(Time, INTOBJ_INT(0)); - AssGVar_NoReadOnlyCheck(MemoryAllocated, INTOBJ_INT(0)); + + AssReadOnlyGVar(GVarName("last"), Fail); + AssReadOnlyGVar(GVarName("last2"), Fail); + AssReadOnlyGVar(GVarName("last3"), Fail); + AssReadOnlyGVar(Time, INTOBJ_INT(0)); + AssReadOnlyGVar(MemoryAllocated, INTOBJ_INT(0)); QUITTINGGVar = GVarName( "QUITTING" ); /* return success */ diff --git a/src/scanner.c b/src/scanner.c index 86dceb0f09e..d17c23decd7 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -845,7 +845,6 @@ static void GetChar(void) { /* skip '\'' */ Char c = GET_NEXT_CHAR(); - /* handle escape equences */ if ( c == '\n' ) { SyntaxError("Character literal must not include ");