Re: How to develop a random number generation device



On Mon, 17 Sep 2007 23:30:32 +0000, Vladimir Vassilevsky wrote:

I'm not talking about process isolation. I'm talking about the ability to
make a program behave other than how its author intended by overrunning a
a buffer (e.g. by making some portion of its input larger than the buffer
in which it will be stored).

It is possible to declare every data object in a program as a separate
segment. That is what LDT was intended for. Of course, there will be a
lot of overhead and the compatibility issues, too.

One problem with that is that you're limited to 8192 segments per process.

In theory, you could use segments only for "active" objects, and have
something like the Local{Lock,Unlock} of 8086-mode Windows. But apart from
producing really ugly code (and adding overhead), it only helps to the
extent that the code chooses to make use of it.

Some code can use a lot of arrays, e.g. an array of structures, each of
which contains an array of characters. Chances are that the programmer
will use a segment for the larger array and leave the character arrays as
just a range of bytes within the segment.

If you can accept mechanisms which impose significant constraints on
coding, you may as well just forbid the use of arrays in favour of an
opaque "vector" type whose accessor methods/functions perform bounds
checking.

Both methods work just as well (i.e. they work if you use them, and don't
work if you don't use them), but the OS-level option adds a lot more
overhead.

The realistic approach to eliminating buffer overruns is not to write word
processors and web browsers in a language which was designed for writing
an OS kernel and device drivers. If arrays are a distinct type, having
both a start and end (to allow bounds checking), and pointer arithmetic is
impossible (or at least not actively encouraged), buffer overruns would be
an obscure theoretical issue rather than an everyday occurrence.

.



Relevant Pages

  • Re: [] arrays, again
    ... or (baseaddr index)? ... The convention introduced by Julian Noble for 1 and 2-D arrays in ... Or copy the data into a hardware buffer for transmission... ... the -1-st cell contains something so useful. ...
    (comp.lang.forth)
  • Re: speed it up
    ... Gernot Frisch wrote: ... I'm transfering my back buffer to the display memory here. ... You may also get more performance by declaring the arrays the same ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.cpp)
  • Re: [] arrays, again
    ... Scientific Library (FSL). ... The problem is that you do not always have arrays. ... Or copy the data into a hardware buffer for transmission... ... I do this all the time by defining "sizeof" constants ...
    (comp.lang.forth)
  • Re: Understanding ByteBuffer
    ... One clue is the limit method of Buffer. ... and arrays and collections all with the exact same syntax to process ... I have written a little essay on what I have learned about ByteBuffer. ... It turns out it is not nearly as clever as thought it was. ...
    (comp.lang.java.programmer)
  • Re: How to assign string in a variable to another array in Matlab?
    ... segment of my code below. ... help for strings and how they fit into arrays. ...
    (comp.soft-sys.matlab)