For Programmers: Free Programming Magazines  


Home > Archive > Fortran > June 2005 > Re: Public disclosure of discovered vulnerabilities









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Public disclosure of discovered vulnerabilities
glen herrmannsfeldt

2005-06-06, 3:58 pm

Jan Vorbrüggen wrote:
(snip)

> Even the late-70s/early-80s DEC FORTRAN compiler only did run-time inter-
> pretation of format strings if it needed, i.e., if you used a string
> variable
> as a format statement. Isn't that an F77 feature, anyway?


> For compile-time format strings, the compiler actually generated a series
> of calls, with pre-compiled arguments, to the RTL to execute the format.
> No interpretation in sight. When a run-time format was executed, there was
> a single call to the interpretation routine, and then a series of calls to
> execute it. Because the I/O list is always known at compile time, this list
> of calls was definable at compile time in any case.


Ones I know convert to an internal format and interpret that. I suppose
in some cases it could be done differently, but consider:

WRITE(6,1) (A(I),I=1,N),B

You can't figure out at compile time which format code goes to B.

> Compared to what was state of the art at the time in (s)printf, Fortran
> format statements are a model of efficiency. How many C compilers, even
> today, translate an sprintf call into a series of primitive string
> operations
> instead of calling the full format interpreter?


I have been surprised to see C compilers actually test for the
appropriate number of arguments to printf based on the format. I don't
know that they actually optimize anything, though.

-- glen

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com