NSPR and 64 Bits

Stefan Birrer <[email protected]> Fri, 26 Mar 2010 15:27:51 +0100
Newsgroups gmane.comp.mozilla.devel.nspr
Organization AdNovum Informatik AG
Message-ID <[email protected]>
Hello everyone, 

what is NSPR's strategy concerning 64-bit technology? 

I know, it compiles and runs on 64-bit platforms, I've tried that myself.
But some compilers, e.g. Microsoft Visual Studio 2008, issue warnings when
I try things like

void * myPointer = PR_Malloc(sizeof(myStruct));

The warning is absolutely legitimate because the output of sizeof, which has
64 bit length, is casted to a PRUint32, which of course has 32 bit length. 

Throughout NSPR, most often PRUint32 is used to declare sizes of things
instead of PRSize. On 32-bit platforms, this is not a problem, because
PRUint32 and PRSize are the same. But on 64-bit platforms, they are
different, causing potential for buffer overflows. 

Are there any plans to adapt/extend the NSPR API and provide functions that
use PRSize to specify the size of things? 

Kind regards,
Stefan Birrer

-- 

 AdNovum Informatik AG
 Stefan Birrer, Software Engineer
 Dipl. Informatik-Ing. ETH

 Roentgenstrasse 22, CH-8005 Zurich
 mailto:[email protected]
 phone: +41 44 272 6111, fax: +41 44 272 6312
 http://www.adnovum.ch

 AdNovum Locations: Bern, Budapest, Zurich (HQ)