ignore security and it'll go away

tryseg-unix.c

tryseg-unix.c
Posted Sep 25, 1999
Authored by synnergy, Guidob | Site synnergy.net

Test for catching the SIGSEGV or SIGBUS without crashing and combined with try{}catch(){}.

MD5 | 28fb588cdc4a9301765c334bcced53fb

tryseg-unix.c

Change Mirror Download
// *** Synnergy Networks

// * Description:
//
// Test for catching the SIGSEGV or SIGBUS without crashing
// and combined with try{}catch(){}

// * Author:
//
// guidob (guidob@synnergy.net)
// Synnergy Networks (c) 1999, http://www.synnergy.net

// * Greets:
//
// Synnergy Networks, Hit2000 crew, Cindy

// * Comments:
//
// For more details, read the source.

// *** Synnergy Networks

#include <iostream.h>
#include <signal.h>
#include <stdlib.h>
#include <siginfo.h>

struct report {

int err;
int sig;
int critval;

} page1 = { 0, 0, 0 };

void notwithme(int);
int beyond(int);

int main(){

int i;

try{

sigset(SIGSEGV,notwithme);
sigset(SIGBUS,notwithme);

for(i=10000;;i++){

beyond(i);

cout << "Survifed beyond i = " << i << endl;
}
}
catch(report& seite1){

cout << "Yes we made it into the catch()" << endl;

cout << "seite1.err is: " << seite1.err << endl;
cout << "seite1.sig is: " << seite1.sig << endl;
cout << "seite1.critval is: " << seite1.critval << endl;

return(0);

}
catch(...){

cout << "Came to the second catch()" << endl;

return(1);
}

cout << "After the catch block" << endl;

return(1);

} // end of main()

int beyond(int i){

int a[50];
page1.critval = i;

// Main operation which causes an unforseen error

a[i]=1;

return(1);
}

void notwithme(int sig){

psignal(sig, "Function notwithme() got signal: ");

page1.err = 1;
page1.sig = sig;

throw page1;

return;
}

// EOF

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close