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:

April 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close