Re: Program analysis
- From: muede73 <muede73@xxxxxx>
- Date: Thu, 09 Aug 2007 22:17:03 +0200
slebetman@xxxxxxxxx wrote:
Take for example strcpy(). It copies data bytewise from one part of
memory to another until it finds the nul terminator "\0". Now, try
strcpying from an uninitialised memory. You don't know if strcpy()
will halt. You also don't know if strcpy() won't halt since you don't
know the contents of memory. It is of course highly likely that in the
Megabytes of memory there is at least one byte with a value of \0. But
you don't know that. So the best your value analysis tool can come up
with is:
"This program will most likely halt but I'm not 100% sure".
Here another example, a pseudocode for a very insecure HTTP 1.0
client:
# This is a simple client so we use the old convention
# of the socket closing signifying end of file.
proc webget {domain HTTPrequest} {
set sock [socket $domain 80]
puts $sock $HTTPrequest
# Get the file and wait for end of file:
set result [read $sock]
# At this point we don't know if read will ever return.
# The server could be malicious and send us a neverending
# stream of bytes without ever closing the socket.
# Although you can't guarantee that this function ever returns
# you also can't guarantee that this function never returns.
close $sock
return $result
}
I have the gut feeling, that both problems have little to do with
the actual (theoretic) halting problem. (Though they might have problems with that.)
That's like saying :
It is impossible to prove, there exists a 'x' in A for a 'y' in B
for an unknown (or undefined) function f : A -> B , such that
f(x) = y holds true.
That would be trivial.
-andy
.
- References:
- Program analysis
- From: Tim Frink
- Re: Program analysis
- From: slebetman@xxxxxxxxx
- Program analysis
- Prev by Date: Re: How to get kids to start programming? ...
- Next by Date: Re: Comport baudrate/frequency counter software
- Previous by thread: Re: Program analysis
- Next by thread: Stupid batch question
- Index(es):
Relevant Pages
|