mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* c++ program reboots system.
@ 2002-05-13 12:02 Richard B. Johnson
  2002-05-13 15:38 ` rpm
  0 siblings, 1 reply; 3+ messages in thread
From: Richard B. Johnson @ 2002-05-13 12:02 UTC (permalink / raw)
  To: Linux kernel


I didn't save the address of the person who reported the reboot
error...
This c++ code was reported to reboot a machine.

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <iterator>
using namespace std;
int main(int argc, char** argv)
{
    string raw_filename = "input.out";
    ifstream raw_file(raw_filename.c_str());
    vector<long> data;
    copy(istream_iterator<long>(raw_file),istream_iterator<long>(),back_inserter(data));
    data.erase(data.begin());
    return 0;
}
Script started on Mon May 13 07:51:12 2002
# gdb xxx
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.15 (i586-unknown-linux), Copyright 1995 Free Software Foundation, Inc...
(gdb) run
Starting program: /root/xxx 

Program received signal SIGSEGV, Segmentation fault.
ostream::flush (this=0x8c224) at iostream.cc:864
864	    if (_strbuf->sync())
(gdb) quit
The program is running.  Quit anyway (and kill it)? (y or n) y
# exit
exit
Script done on Mon May 13 07:51:49 2002

On Linux 2.4.18, the program just seg-faults (as it should).
On the version you are using, you should write a 'C' program
that does lseek() beyond EOF. There could be a bug there, but
otherwise I can't tell from the program presented.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).

                 Windows-2000/Professional isn't.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-13 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-13 12:02 c++ program reboots system Richard B. Johnson
2002-05-13 15:38 ` rpm
2002-05-13 16:40   ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®