delphidelphi-2009buffer-overflowtstream

tstream is buffer overflow proof?


TStream is an abstract class.

However about its implementations, are they buffer overflow proof?

If I'm fetching a stream from the internet, from a source that is not me, how do I verify that it is not corrupted and cause buffer overflow?

Lets say that the stream is an xml file.

edit: all the answers indicate you need to check for buffer overflow. could you demonstrate how to check a buffer overflow on an input file, where we know that a stream could be infinite by its definition?


Solution

  • TStream and its various RTL descendents do not have any bugs that result in buffer overruns, to the best of my knowledge.

    However, your code using Delphi streams could easily overrun a buffer.