what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

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(){}.

SHA-256 | 433fc3dd738edd7c15e31f6955b42940c9811cbd42f2c5eeb0cdb4401538fd0a

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
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    0 Files
  • 9
    Sep 9th
    0 Files
  • 10
    Sep 10th
    0 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close