Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. Dangling pointers
and wild pointers in computer programming are pointers that do not point
to a valid object of the appropriate type. These are special cases of
violations of memory safety. Dangling pointers arise when an object is
deleted or deallocated, without modifying the value of the pointer, so
that the pointer still points to the memory location of the deallocated
memory. As the system may reallocate the previously freed memory to
another process, if the original program then dereferences the dangling
pointer, unpredictable behavior may result, as the memory may now
contain completely different data. This is especially the case if the
program writes data to memory pointed by a dangling pointer, a silent
corruption of unrelated data may result, leading to subtle bugs that can
be extremely difficult to find, or cause segmentation faults or general
protection faults. If the overwritten data is bookkeeping data used by
the system's memory allocator, the corruption can cause system
instabilities. Wild pointers arise when a pointer is used prior to
initialization to some known state, which is possible in some
programming languages.