473,837 Members | 1,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need experts suggestion

Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?

I, guess, buffer overflow method mite help!Not sure.

Plz let me know.

-thanks and regards,

Gsec

May 26 '06 #1
68 3219

Gsec wrote:
Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?
Pick your poison:

for ( ; ; ) { /* whatever */ }
while ( 1 ) { /* whatever */ }
do { /* whatever */ } while ( 1 );

inf_label:
/* whatever */
goto inf_label;

Of course you have to make sure that { /* whatever */ } does not
crash.
I, guess, buffer overflow method mite help!Not sure.
I don't know what buffer overflow has to do with infinte loop. I'm even
more baffled by mites.
Plz let me know.


Oh, sorry. I didn't realise you wanted Plz to help you. Oh, well...

May 26 '06 #2
Hi,

Thanks;-). But, I don't think, any one will do. Try it first, then if
it doesn't crash after one week (;-) ), let me know !;-)

gsec
Vladimir Oka wrote:
Gsec wrote:
Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?


Pick your poison:

for ( ; ; ) { /* whatever */ }
while ( 1 ) { /* whatever */ }
do { /* whatever */ } while ( 1 );

inf_label:
/* whatever */
goto inf_label;

Of course you have to make sure that { /* whatever */ } does not
crash.
I, guess, buffer overflow method mite help!Not sure.


I don't know what buffer overflow has to do with infinte loop. I'm even
more baffled by mites.
Plz let me know.


Oh, sorry. I didn't realise you wanted Plz to help you. Oh, well...


May 26 '06 #3

"Gsec" <Ga***********@ gmail.com> wrote in message
news:11******** **************@ j55g2000cwa.goo glegroups.com.. .
Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?

I, guess, buffer overflow method mite help!Not sure.

Plz let me know.


I take it that you want to insert code in the infinite loop? And, you'd
like the unmentioned code to recover from whatever fault may be generated?
I'm supposing that is you intended to ask...

If so, you need to look at:
1) setjmp(), jmpto() and jmpbuf[] to restore as much as possible of the
pre-fault execution context
2) signal() for turning off signals, by setting SIGBREAK (or SIGQUIT),
SIGINT, and SIGABRT to SIG_IGN
3) turning off any Ctrl-C or Ctrl-break handling, using some non-standard
function, like setcbrk() or break_off()
Rod Pemberton
May 26 '06 #4
Gsec wrote:

Hi,

Thanks;-). But, I don't think, any one will do. Try it first, then if
it doesn't crash after one week (;-) ), let me know !;-)

gsec
Vladimir Oka wrote:
Gsec wrote:
Hi,

Can anybody let me know how to write a infinite loop,
such that the
program never crashes ?


Pick your poison:

for ( ; ; ) { /* whatever */ }
while ( 1 ) { /* whatever */ }
do { /* whatever */ } while ( 1 );

inf_label:
/* whatever */
goto inf_label;

Of course you have to make sure that { /* whatever */ } does not
crash.
I, guess, buffer overflow method mite help!Not sure.


I don't know what buffer overflow has to do with infinte loop.


Buffer overflow has nothing to do with infinte loop,
as I'm sure you know.

OP is acting the clown.

--
pete
May 26 '06 #5
Hi Pemb,

Thanks. Sorry that my question was not that clear before. Well let me
make the picture very clear. My question is from Stack overflow point
of view.If you write an infinite loop simply, it will crash after some
time. Similarly, if we call main() within main (),
it will crash after some time definitely due to stack overflow !

So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.

I hope, now you can let me know more information on my query.

Thanks.

Gsec

May 26 '06 #6
Gsec wrote:
Hi Pemb,

Thanks. Sorry that my question was not that clear before. Well let me
make the picture very clear. My question is from Stack overflow point
of view.
The C langauge does not define stacks.
If you write an infinite loop simply, it will crash after some
time. Similarly, if we call main() within main (),
it will crash after some time definitely due to stack overflow !
I think you're confusing a recursive function call from an infinite
loop. The former will likely crash after sometime while the latter
should not.
So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.


Buffer overflow has nothing to do with infinite loops.

May 26 '06 #7
Gsec said:
Hi,

Thanks;-). But, I don't think, any one will do. Try it first, then if
it doesn't crash after one week (;-) ), let me know !;-)


I have had an infinite loop under test since the beginning of March. So far,
we're looking good - but it's early days yet.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
May 26 '06 #8
Gsec said:
So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.


It's more likely to have the opposite effect. The way to avoid segfaults in
your program is to write the code properly.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
May 26 '06 #9
Gsec wrote:
Hi Pemb,

Thanks. Sorry that my question was not that clear before. Well let me
make the picture very clear. My question is from Stack overflow point
of view.If you write an infinite loop simply, it will crash after some
time.
What makes you think `while (1) {}` will ever crash?
Similarly, if we call main() within main (),
it will crash after some time definitely due to stack overflow !
You think so?

int main(void) { return main(); }

need not crash.

<fx:codingHappe ns/>

Make that "does not crash".
So, I think that the buffer overflow method will let me my program to
execute on an infinite way, with no SIGSEGV.


I have this feeling you're not asking the question you mean to ask.

--
Chris "gcc -O4 main.c; ./a.out" Dollin
"We did not have time to find out everything we wanted to know." /A Clash of Cymbals/

May 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1846
by: Kevin Carne | last post by:
First, Merry Christmas. I have been doing intensive Java programming for two years in school (no choice on the language), but now I need to return to C++ because my resume is filled with it both in Windows and Unix and I need work because I am graduating in a few months. Instead of just reading books to refresh my memory, I'm going to build a large (4 month) project that encompasses all the C++ material. I think this is a better way of...
1
2551
by: theintrepidfox | last post by:
Dear Group. Wondered if any of you has any suggestion for the following? Trying to install SQL Server 2005 Eval on a 'clean' machine. Well, my mistake was probably that I had installed Visual Studio 2005 Professional Eval before which installed an MSSQL Express instance. Since then I didn't get 'Enterprise Manager' (excuse my ignorance, I know it's called differently in2005 but it's late and I'm tired) for MSSQL 2005 installed.Don't...
9
1768
by: perry.yuan | last post by:
Hi there, I got a problem: how to return an lvalue from conditional expression in C programming language. Any solution or suggestion to my problem in either C or C++ is welcome. On the CPU (actually it is a DSP), memory is addressed in 16 bit unit (called word). There is a struct of variable size (in pseudo code):
2
1740
by: cfriedalek | last post by:
OK, I've asked this earlier this week with no response. Since then I've also received a suggestion from the app developers but that failed with the same type error problem. Hopefully Mark Hammond or other experts can offer a suggestion as to how to get around this problem. I'm foolish enough to think that a solution can be found. Or can someone suggest how to pm Mark. --------------------------- I'm using pywin32com to drive a 3rd...
0
9839
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10564
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10621
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5846
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4039
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3123
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.