Microsoft open sources GWBASIC

Norman Jaffe turing at shaw.ca
Fri May 29 19:07:35 CDT 2020


Fun that I have had with Fortran: 
1) Passing an integer constant where a variable was expected, and having that constant modified by the called routine; on an IBM 1800 / TSX, small integer constants were stored in an area shared with the operating system, so it was supremely easy to change the value of 5 for all programs on the machine. 
2) Naming a program with my first name (Norm) and having it go into an infinite loop when it did a floating point calculation. 

From: "cctalk" <cctalk at classiccmp.org> 
To: "cctalk" <cctalk at classiccmp.org> 
Sent: Friday, May 29, 2020 4:32:38 PM 
Subject: Re: Microsoft open sources GWBASIC 

On 5/29/20 3:41 PM, Fred Cisin via cctalk wrote: 
Yes, a pointer to the PC Interrupt Vector Table could be problematic. 
> 
> C lets you do a lot of things that some other languages will protect you 
> from. Accordingly, Allen Holub titled one of his books about C, "Enough 
> Rope To Shoot Yourself In The Foot" 
> ISBN-10: 0070296898 
> ISBN-13: 978-0070296893 

Oh, FORTRAN can do likewise--I suspect that most languages can be coaxed 
(perhaps with some assembly-language subroutines)to do something nasty. 

Two cases in point (but I have lots more). In the CDC 60-bit machines, 
one of the most useful functions was LOC(). It passes the address of 
the argument. Note that this was basically a single instruction as 
FORTRAN uses call-by-reference in most older versions. 

The other aspect of the CDC operating systems is that PPMTR looked 
periodically at each user's location 1 for system requests. So, it was 
a simple matter to use LOC() to obtain a negative subscript into an 
array to write and read that location. With the ability to make system 
requests directly (and directly address user memory), the sky is the 
limit. Indeed several user-written system utilities were written using 
just that technique. The CDC iron is word-addressable only. 

(Other abuses were the arbitrary target for the ASSIGNed GOTO, but 
that's another subject). 

Similarly, BASIC, depending on the version, could be abused. One 
technique was to use a character array with the BASED attribute (I don't 
know if I was the first to invent that keyword, but it was around 1978). 
That turned the variable into a pointer and one could change the area 
that the variable pointed to with the BASE...AT statement. Several 
utilities were written in this fashion, including a few that located the 
video refresh buffer and wrote to it directly. 

I've been known to do similar nasty things in COBOL. 

Side question: How does one create named COMMON in C? 

--Chuck 


More information about the cctech mailing list