int FileInStream::overrun(int itemSize, int nItems, bool wait)
{
  if (itemSize > (int)sizeof(b))
    throw Exception("FileInStream overrun: max itemSize exceeded");

  if (end - ptr != 0)
    memmove(b, ptr, end - ptr);

  end -= ptr - b;
  ptr = b;


  while (end < b + itemSize) {
    size_t n = fread((U8 *)end, b + sizeof(b) - end, 1, file);
    if (n == 0) {
      if (ferror(file))
        throw SystemException("fread", errno);
      if (feof(file))
        throw EndOfStream();
      return 0;
    }
    end += b + sizeof(b) - end;
  }

  if (itemSize * nItems > end - ptr)
    nItems = (end - ptr) / itemSize;

  return nItems;
}
The software writes data past the end, or before the beginning, of the intended buffer.