Subject: RE: NULL pointer return values
To: None <tech-kern@netbsd.org>
From: Stephane St Hilaire <ssthilaire@hyperchip.com>
List: tech-kern
Date: 04/24/2002 19:36:45
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1EBE8.E5354C60
Content-Type: text/plain
> -----Original Message-----
> From: der Mouse [mailto:mouse@Rodents.Montreal.QC.CA]
> Sent: Tuesday, April 23, 2002 11:58 PM
> To: tech-kern@netbsd.org
> Subject: Re: NULL pointer return values
>
>
> it doesn't point to any C language entity. Dereferencing it can get
> you anything or nothing - it can give you memory at address zero, it
> can give you memory somewhere else, it can give you a fatal trap, it
> can halt the machine, it can melt the CPU down into a puddle of liquid
> silicon, it can even (at least as far as the C language is concerned)
> it can make demons fly out of your nose. (Yes, I cribbed that last.)
>
> > unless
> > long *ptr = 0x00000000;
In Novell for example (if anyone cares) address 0 and a few addresses after
it were setup with 0xC or 0xCC's (I don't quite remember which) anyway these
were the intel opcodes to generate INT 3 or the debugger breakpoint handler
which basically meant that if you called a NULL (or a 0 if you don't like C
#defines...)function pointer you would automatically invoke the internal
debugger.
Sorry for any HTML content whatsoever, this was sent as plain-text.
Steph
------_=_NextPart_001_01C1EBE8.E5354C60
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: NULL pointer return values</TITLE>
</HEAD>
<BODY>
<BR>
<P><FONT SIZE=3D2>> -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> From: der Mouse [<A =
HREF=3D"mailto:mouse@Rodents.Montreal.QC.CA">mailto:mouse@Rodents.Montre=
al.QC.CA</A>]</FONT>
<BR><FONT SIZE=3D2>> Sent: Tuesday, April 23, 2002 11:58 PM</FONT>
<BR><FONT SIZE=3D2>> To: tech-kern@netbsd.org</FONT>
<BR><FONT SIZE=3D2>> Subject: Re: NULL pointer return values</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> it doesn't point to any C language =
entity. Dereferencing it can get</FONT>
<BR><FONT SIZE=3D2>> you anything or nothing - it can give you =
memory at address zero, it</FONT>
<BR><FONT SIZE=3D2>> can give you memory somewhere else, it can give =
you a fatal trap, it</FONT>
<BR><FONT SIZE=3D2>> can halt the machine, it can melt the CPU down =
into a puddle of liquid</FONT>
<BR><FONT SIZE=3D2>> silicon, it can even (at least as far as the C =
language is concerned)</FONT>
<BR><FONT SIZE=3D2>> it can make demons fly out of your nose. =
(Yes, I cribbed that last.)</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> > unless</FONT>
<BR><FONT SIZE=3D2>> > long *ptr =3D 0x00000000;</FONT>
</P>
<P><FONT SIZE=3D2>In Novell for example (if anyone cares) address 0 and =
a few addresses after it were setup with 0xC or 0xCC's (I don't quite =
remember which) anyway these were the intel opcodes to generate INT 3 =
or the debugger breakpoint handler which basically meant that if you =
called a NULL (or a 0 if you don't like C #defines...)function pointer =
you would automatically invoke the internal debugger.</FONT></P>
<P><FONT SIZE=3D2>Sorry for any HTML content whatsoever, this was sent =
as plain-text.</FONT>
</P>
<P><FONT SIZE=3D2>Steph</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C1EBE8.E5354C60--