<s>
In	O
computing	O
,	O
an	O
uninitialized	B-Error_Name
variable	I-Error_Name
is	O
a	O
variable	O
that	O
is	O
declared	O
but	O
is	O
not	O
set	O
to	O
a	O
definite	O
known	O
value	O
before	O
it	O
is	O
used	O
.	O
</s>
<s>
As	O
such	O
,	O
it	O
is	O
a	O
programming	B-Error_Name
error	I-Error_Name
and	O
a	O
common	O
source	O
of	O
bugs	B-Error_Name
in	O
software	O
.	O
</s>
<s>
While	O
this	O
is	O
true	O
for	O
many	O
languages	O
,	O
it	O
is	O
not	O
true	O
for	O
all	O
of	O
them	O
,	O
and	O
so	O
the	O
potential	O
for	O
error	B-Error_Name
is	O
there	O
.	O
</s>
<s>
Languages	O
such	O
as	O
C	B-Language
use	O
stack	B-Application
space	O
for	O
variables	O
,	O
and	O
the	O
collection	O
of	O
variables	O
allocated	O
for	O
a	O
subroutine	O
is	O
known	O
as	O
a	O
stack	B-Application
frame	O
.	O
</s>
<s>
While	O
the	O
computer	O
will	O
set	O
aside	O
the	O
appropriate	O
amount	O
of	O
space	O
for	O
the	O
stack	B-Application
frame	O
,	O
it	O
usually	O
does	O
so	O
simply	O
by	O
adjusting	O
the	O
value	O
of	O
the	O
stack	B-Application
pointer	O
,	O
and	O
does	O
not	O
set	O
the	O
memory	B-General_Concept
itself	O
to	O
any	O
new	O
state	O
(	O
typically	O
out	O
of	O
efficiency	O
concerns	O
)	O
.	O
</s>
<s>
Therefore	O
,	O
whatever	O
contents	O
of	O
that	O
memory	B-General_Concept
at	O
the	O
time	O
will	O
appear	O
as	O
initial	O
values	O
of	O
the	O
variables	O
which	O
occupy	O
those	O
addresses	O
.	O
</s>
<s>
Here	O
's	O
a	O
simple	O
example	O
in	O
C	B-Language
:	O
</s>
<s>
Another	O
example	O
can	O
be	O
when	O
dealing	O
with	O
structs	B-Application
.	O
</s>
<s>
In	O
the	O
code	O
snippet	O
below	O
,	O
we	O
have	O
a	O
struct	B-Application
student	O
which	O
contains	O
some	O
variables	O
describing	O
the	O
information	O
about	O
a	O
student	O
.	O
</s>
<s>
The	O
function	O
register_student	O
leaks	O
memory	B-General_Concept
contents	O
because	O
it	O
fails	O
to	O
fully	O
initialize	O
the	O
members	O
of	O
struct	B-Application
student	O
new_student	O
.	O
</s>
<s>
This	O
is	O
because	O
if	O
the	O
length	O
of	O
first_name	O
and	O
last_name	O
character	O
arrays	O
are	O
less	O
than	O
16	O
bytes	O
,	O
during	O
the	O
strcpy	O
,	O
we	O
fail	O
to	O
fully	O
initialize	O
the	O
entire	O
16	O
bytes	O
of	O
memory	B-General_Concept
reserved	O
for	O
each	O
of	O
these	O
members	O
.	O
</s>
<s>
Hence	O
after	O
memcpy( )	O
'	O
ing	O
the	O
resulted	O
struct	B-Application
to	O
output	O
,	O
we	O
leak	O
some	O
stack	B-Application
memory	B-General_Concept
to	O
the	O
caller	O
.	O
</s>
<s>
In	O
C	B-Language
,	O
variables	O
with	O
static	O
storage	O
duration	O
that	O
are	O
not	O
initialized	O
explicitly	O
are	O
initialized	O
to	O
zero	O
(	O
or	O
null	O
,	O
for	O
pointers	O
)	O
.	O
</s>
<s>
Not	O
only	O
are	O
uninitialized	B-Error_Name
variables	I-Error_Name
a	O
frequent	O
cause	O
of	O
bugs	B-Error_Name
,	O
but	O
this	O
kind	O
of	O
bug	B-Error_Name
is	O
particularly	O
serious	O
because	O
it	O
may	O
not	O
be	O
reproducible	O
:	O
for	O
instance	O
,	O
a	O
variable	O
may	O
remain	O
uninitialized	O
only	O
in	O
some	O
branch	B-Language
of	O
the	O
program	O
.	O
</s>
<s>
In	O
some	O
cases	O
,	O
programs	O
with	O
uninitialized	B-Error_Name
variables	I-Error_Name
may	O
even	O
pass	O
software	O
tests	O
.	O
</s>
<s>
Uninitialized	B-Error_Name
variables	I-Error_Name
are	O
powerful	O
bugs	B-Error_Name
since	O
they	O
can	O
be	O
exploited	O
to	O
leak	O
arbitrary	O
memory	B-General_Concept
or	O
to	O
achieve	O
arbitrary	O
memory	B-General_Concept
overwrite	O
or	O
to	O
gain	O
code	O
execution	O
,	O
depending	O
on	O
the	O
case	O
.	O
</s>
<s>
When	O
exploiting	O
a	O
software	O
which	O
utilizes	O
address	B-General_Concept
space	I-General_Concept
layout	O
randomization	O
(	O
ASLR	O
)	O
,	O
it	O
is	O
often	O
required	O
to	O
know	O
the	O
base	B-General_Concept
address	I-General_Concept
of	O
the	O
software	O
in	O
memory	B-General_Concept
.	O
</s>
<s>
Exploiting	O
an	O
uninitialized	B-Error_Name
variable	I-Error_Name
in	O
a	O
way	O
to	O
force	O
the	O
software	O
to	O
leak	O
a	O
pointer	O
from	O
its	O
address	B-General_Concept
space	I-General_Concept
can	O
be	O
used	O
to	O
bypass	O
ASLR	O
.	O
</s>
<s>
Uninitialized	B-Error_Name
variables	I-Error_Name
are	O
a	O
particular	O
problem	O
in	O
languages	O
such	O
as	O
assembly	O
language	O
,	O
C	B-Language
,	O
and	O
C++	B-Language
,	O
which	O
were	O
designed	O
for	O
systems	B-Application
programming	I-Application
.	O
</s>
<s>
The	O
programmer	O
was	O
given	O
the	O
burden	O
of	O
being	O
aware	O
of	O
dangerous	O
issues	O
such	O
as	O
uninitialized	B-Error_Name
variables	I-Error_Name
.	O
</s>
<s>
VHDL	B-Language
initializes	O
all	O
standard	O
variables	O
into	O
special	O
'	O
U	O
 '	O
value	O
.	O
</s>
<s>
Java	B-Language
does	O
not	O
have	O
uninitialized	B-Error_Name
variables	I-Error_Name
.	O
</s>
<s>
Local	O
variables	O
in	O
Java	B-Language
must	O
be	O
definitely	O
assigned	O
to	O
before	O
they	O
are	O
accessed	O
,	O
or	O
it	O
is	O
a	O
compile	B-Language
error	B-Error_Name
.	O
</s>
<s>
Python	B-Language
initializes	O
local	O
variables	O
to	O
NULL	O
(	O
distinct	O
from	O
None	O
)	O
and	O
raises	O
an	O
UnboundLocalError	O
when	O
such	O
a	O
variable	O
is	O
accessed	O
before	O
being	O
(	O
re	O
)	O
initialized	O
to	O
a	O
valid	O
value	O
.	O
</s>
<s>
D	B-Application
initializes	O
all	O
variables	O
unless	O
explicitly	O
specified	O
by	O
the	O
programmer	O
not	O
to	O
.	O
</s>
<s>
Even	O
in	O
languages	O
where	O
uninitialized	B-Error_Name
variables	I-Error_Name
are	O
allowed	O
,	O
many	O
compilers	B-Language
will	O
attempt	O
to	O
identify	O
the	O
use	O
of	O
uninitialized	B-Error_Name
variables	I-Error_Name
and	O
report	O
them	O
as	O
compile-time	B-Application
errors	I-Application
.	O
</s>
<s>
Some	O
languages	O
assist	O
this	O
task	O
by	O
offering	O
constructs	O
to	O
handle	O
the	O
initializedness	O
of	O
variables	O
;	O
for	O
example	O
,	O
C#	B-Application
has	O
a	O
special	O
flavour	O
of	O
call-by-reference	O
parameters	O
to	O
subroutines	O
(	O
specified	O
as	O
out	O
instead	O
of	O
the	O
usual	O
ref	O
)	O
,	O
asserting	O
that	O
the	O
variable	O
is	O
allowed	O
to	O
be	O
uninitialized	O
on	O
entry	O
but	O
will	O
be	O
initizalized	O
afterwards	O
.	O
</s>
