Re: Program analysis



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
.



Relevant Pages

  • RE: Any reason not to use strcpy, strcat or scanf?
    ... weakness in memory related function calls, such as strcpy, strcat, memcpy, ... Any reason not to use strcpy, ... to facilitate one-on-one interaction with one of our expert instructors. ... Attend a course taught by an expert instructor with years of in-the-field ...
    (Security-Basics)
  • Re: Tcl UDP Server memory leak more info.
    ... Also changing the server reply to a puts to stdio, seems to suggest that the call-back sendTime is being invoked twice for each message received from client. ... proc sendTime {sock} { ... set peer ... More worrying to me is the speed at which the server's memory size is growing, ...
    (comp.lang.tcl)
  • Re: 11/40 misbehaviour
    ... When it 'dies', does it halt, or lock up so that none of the console ... every memory access is destructive, and the data must be written back). ... it was via the 'trap catcher', then the display will show the vector + 4 ...
    (comp.sys.dec)
  • Re: Best practice using large objects in foreach
    ... I dont't think there would be no halt because the objects remain in gen1. ... And on the server side GC is concurrent. ... it's always imperative to Dispose() as fast as you can. ... so you will see the memory usage ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [RFC v5][PATCH 2/4] intel_txt: Intel(R) TXT reboot/halt shutdown support
    ... attempting to reboot or halt the system will cause the ... TXT hardware to lock memory upon system restart because the secrets-in-memory ... flag that was set on launch was never cleared. ...
    (Linux-Kernel)