Update NSPR to the NSPR_HEAD_20090801 CVS tag.
authorWan-Teh Chang <wtc@google.com>
Fri, 07 Aug 2009 08:48:30 -0700
changeset 31222 df1fe9160875eea0a41f9f405a71ecdee508c9c0
parent 31000 0b159e56802e1663d6ab821c3c7af5c6e921b88d
child 31223 894652c37f1110dabd4e762c061736764bce1396
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs492779, 501864, 504379, 505889, 507506
milestone1.9.2a1pre
Update NSPR to the NSPR_HEAD_20090801 CVS tag. - Change version from 4.8 to 4.8.1 Beta - Fix bug 492779, bug 501864, bug 504379, bug 505889, bug 507506
nsprpub/admin/repackage.sh
nsprpub/config/prdepend.h
nsprpub/configure
nsprpub/configure.in
nsprpub/lib/libc/include/plbase64.h
nsprpub/lib/libc/src/base64.c
nsprpub/lib/libc/src/strlen.c
nsprpub/pr/include/md/_symbian.cfg
nsprpub/pr/include/md/_symbian.h
nsprpub/pr/include/prinit.h
nsprpub/pr/src/md/windows/ntmisc.c
nsprpub/pr/src/misc/prtrace.c
nsprpub/pr/tests/vercheck.c
--- a/nsprpub/admin/repackage.sh
+++ b/nsprpub/admin/repackage.sh
@@ -59,20 +59,20 @@
 # Note! Files written with Gnu tar are not readable by some non-Gnu
 # versions. Sun, in particular.
 # 
 # 
 # 
 # 
 # ------------------------------------------------------------------
 
-FROMTOP=/share/builds/components/nspr20/v4.8
-TOTOP=./v4.8
-NSPRDIR=nspr-4.8
-SOURCETAG=NSPR_4_8_RTM
+FROMTOP=/share/builds/components/nspr20/v4.8.1
+TOTOP=./v4.8.1
+NSPRDIR=nspr-4.8.1
+SOURCETAG=NSPR_4_8_1_RTM
 
 #
 # enumerate Unix object directories on /s/b/c
 UNIX_OBJDIRS="
 HP-UXB.11.11_64_DBG.OBJ
 HP-UXB.11.11_64_OPT.OBJ
 HP-UXB.11.11_DBG.OBJ
 HP-UXB.11.11_OPT.OBJ
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -37,8 +37,9 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSPR in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
+
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -690,17 +690,17 @@ echo "$ac_t""$build" 1>&6
 test "$host_alias" != "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=8
-MOD_PATCH_VERSION=0
+MOD_PATCH_VERSION=1
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -4227,16 +4227,17 @@ EOF
 
     DLLFLAGS='-OUT:"$@"'
     if test -n "$MOZ_DEBUG_SYMBOLS"; then
         OS_LDFLAGS=-DEBUG -DEBUGTYPE:CV
         OS_DLLFLAGS=-DEBUG -DEBUGTYPE:CV
         DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV
     fi
     _DEBUG_FLAGS=-Zi
+    _OPTIMIZE_FLAGS=-O2
     ;;
 
 *-ncr-sysv*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
     cat >> confdefs.h <<\EOF
@@ -4500,27 +4501,27 @@ EOF
     if test -z "$GNU_CC"; then
         CC="$CC -std1 -ieee_with_inexact"
         if test "$OS_RELEASE" != "V2.0"; then
             CC="$CC -readonly_strings"
         fi
         _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
         ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4509: checking for machine/builtins.h" >&5
+echo "configure:4510: checking for machine/builtins.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4514 "configure"
+#line 4515 "configure"
 #include "confdefs.h"
 #include <machine/builtins.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -5159,63 +5160,63 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 
 
 case $target in
 *-darwin*|*-beos*)
     ;;
 *)
     echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5168: checking for dlopen in -ldl" >&5
+echo "configure:5169: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5176 "configure"
+#line 5177 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char dlopen();
 
 int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:5187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:5204: checking for dlfcn.h" >&5
+echo "configure:5205: checking for dlfcn.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5209 "configure"
+#line 5210 "configure"
 #include "confdefs.h"
 #include <dlfcn.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
@@ -5238,23 +5239,23 @@ fi
     ;;
 esac
 
 
 
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:5247: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5248: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 5253 "configure"
+#line 5254 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -5262,17 +5263,17 @@ else
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 5271 "configure"
+#line 5272 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
@@ -5286,22 +5287,22 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
 for ac_func in lchown strerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5295: checking for $ac_func" >&5
+echo "configure:5296: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5300 "configure"
+#line 5301 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
 char $ac_func();
@@ -5314,17 +5315,17 @@ int main() {
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
 $ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
@@ -5355,17 +5356,17 @@ if test "${enable_strip+set}" = set; the
 fi
 
 
 case "${target_os}" in
 hpux*)
 if test -z "$GNU_CC"; then
 
     echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5364: checking for +Olit support" >&5
+echo "configure:5365: checking for +Olit support" >&5
 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
                   ac_cv_hpux_usable_olit_option=no
         rm -f conftest*
         echo 'int main() { return 0; }' | cat > conftest.c
         ${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
         if test $? -eq 0; then
@@ -5394,17 +5395,17 @@ esac
 
 case "$target_os" in
 darwin*)
     _HAVE_PTHREADS=1
     ;;
 *)
     
 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5403: checking for pthread_create in -lpthreads" >&5
+echo "configure:5404: checking for pthread_create in -lpthreads" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5416,17 +5417,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5425: checking for pthread_create in -lpthread" >&5
+echo "configure:5426: checking for pthread_create in -lpthread" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5438,17 +5439,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5447: checking for pthread_create in -lc_r" >&5
+echo "configure:5448: checking for pthread_create in -lc_r" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5460,17 +5461,17 @@ echo "
     rm -f dummy.c dummy${ac_exeext} ;
     if test "$_res" = "0"; then
         echo "$ac_t""yes" 1>&6
         _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r"
     else
         echo "$ac_t""no" 1>&6
         
 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5469: checking for pthread_create in -lc" >&5
+echo "configure:5470: checking for pthread_create in -lc" >&5
 echo "
     #include <pthread.h> 
     void *foo(void *v) { return v; } 
     int main() { 
         pthread_t t;
         if (!pthread_create(&t, 0, &foo, 0)) {
             pthread_join(t, 0);
         }
@@ -5592,17 +5593,17 @@ EOF
     fi
 fi
 
 
 if test -n "$USE_PTHREADS"; then
       rm -f conftest*
    ac_cv_have_dash_pthread=no
    echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5601: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5602: checking whether ${CC-cc} accepts -pthread" >&5
    echo 'int main() { return 0; }' | cat > conftest.c
    ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
    if test $? -eq 0; then
 	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 	    ac_cv_have_dash_pthread=yes
 		case "$target_os" in
 	    freebsd*)
 # Freebsd doesn't use -pthread for compiles, it uses them for linking
@@ -5615,17 +5616,17 @@ echo "configure:5601: checking whether $
 	fi
     fi
     rm -f conftest*
     echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6
 
 			    ac_cv_have_dash_pthreads=no
     if test "$ac_cv_have_dash_pthread" = "no"; then
 	    echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5624: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5625: checking whether ${CC-cc} accepts -pthreads" >&5
     	echo 'int main() { return 0; }' | cat > conftest.c
 	    ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
     	if test $? -eq 0; then
 	    	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 			    ac_cv_have_dash_pthreads=yes
 			    CFLAGS="$CFLAGS -pthreads"
 			    CXXFLAGS="$CXXFLAGS -pthreads"
 		    fi
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -45,17 +45,17 @@ AC_INIT(config/libc_r.h)
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=8
-MOD_PATCH_VERSION=0
+MOD_PATCH_VERSION=1
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -1679,16 +1679,17 @@ tools are selected during the Xcode/Deve
 
     DLLFLAGS='-OUT:"$@"'
     if test -n "$MOZ_DEBUG_SYMBOLS"; then
         OS_LDFLAGS=-DEBUG -DEBUGTYPE:CV
         OS_DLLFLAGS=-DEBUG -DEBUGTYPE:CV
         DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV
     fi
     _DEBUG_FLAGS=-Zi
+    _OPTIMIZE_FLAGS=-O2
     ;;
 
 *-ncr-sysv*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(SYSV)
     AC_DEFINE(NCR)
     USE_NSPR_THREADS=1
--- a/nsprpub/lib/libc/include/plbase64.h
+++ b/nsprpub/lib/libc/include/plbase64.h
@@ -52,16 +52,20 @@ PR_BEGIN_EXTERN_C
  * is used to determine the source length.  If the "dest" parameter is not
  * null, it is assumed to point to a buffer of sufficient size (which may be
  * calculated: ((srclen + 2)/3)*4) into which the encoded data is placed 
  * (without any termination).  If the "dest" parameter is null, a buffer is
  * allocated from the heap to hold the encoded data, and the result *will*
  * be terminated with an extra null character.  It is the caller's 
  * responsibility to free the result when it is allocated.  A null is returned 
  * if the allocation fails.
+ *
+ * NOTE: when calculating ((srclen + 2)/3)*4), first ensure that
+ *     srclen <= (PR_UINT32_MAX/4) * 3
+ * to avoid PRUint32 overflow.
  */
 
 PR_EXTERN(char *)
 PL_Base64Encode
 (
     const char *src,
     PRUint32    srclen,
     char       *dest
@@ -78,16 +82,22 @@ PL_Base64Encode
  * length.  If the "dest" parameter is not null, it is assumed to point to
  * a buffer of sufficient size (which may be calculated: (srclen * 3)/4
  * when srclen includes the '=' characters) into which the decoded data
  * is placed (without any termination).  If the "dest" parameter is null,
  * a buffer is allocated from the heap to hold the decoded data, and the
  * result *will* be terminated with an extra null character.  It is the
  * caller's responsibility to free the result when it is allocated.  A null
  * is retuned if the allocation fails, or if the source is not well-coded.
+ *
+ * NOTE: when calculating (srclen * 3)/4, first ensure that 
+ *     srclen <= PR_UINT32_MAX/3
+ * to avoid PRUint32 overflow.  Alternatively, calculate
+ *     (srclen/4) * 3 + ((srclen%4) * 3)/4
+ * which is equivalent but doesn't overflow for any value of srclen.
  */
 
 PR_EXTERN(char *)
 PL_Base64Decode
 (
     const char *src,
     PRUint32    srclen,
     char       *dest
--- a/nsprpub/lib/libc/src/base64.c
+++ b/nsprpub/lib/libc/src/base64.c
@@ -33,17 +33,18 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "plbase64.h"
 #include "prlog.h" /* For PR_NOT_REACHED */
 #include "prmem.h" /* for malloc / PR_MALLOC */
-#include "plstr.h" /* for PL_strlen */
+
+#include <string.h> /* for strlen */
 
 static unsigned char *base = (unsigned char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 static void
 encode3to4
 (
     const unsigned char    *src,
     unsigned char          *dest
@@ -145,17 +146,23 @@ PL_Base64Encode
 (
     const char *src,
     PRUint32    srclen,
     char       *dest
 )
 {
     if( 0 == srclen )
     {
-        srclen = PL_strlen(src);
+        size_t len = strlen(src);
+        srclen = len;
+        /* Detect truncation. */
+        if( srclen != len )
+        {
+            return (char *)0;
+        }
     }
 
     if( (char *)0 == dest )
     {
         PRUint32 destlen;
         /* Ensure all PRUint32 values stay within range. */
         if( srclen > (PR_UINT32_MAX/4) * 3 )
         {
@@ -384,17 +391,23 @@ PL_Base64Decode
 
     if( (char *)0 == src )
     {
         return (char *)0;
     }
 
     if( 0 == srclen )
     {
-        srclen = PL_strlen(src);
+        size_t len = strlen(src);
+        srclen = len;
+        /* Detect truncation. */
+        if( srclen != len )
+        {
+            return (char *)0;
+        }
     }
 
     if( srclen && (0 == (srclen & 3)) )
     {
         if( (char)'=' == src[ srclen-1 ] )
         {
             if( (char)'=' == src[ srclen-2 ] )
             {
@@ -405,18 +418,17 @@ PL_Base64Decode
                 srclen -= 1;
             }
         }
     }
 
     if( (char *)0 == dest )
     {
         /* The following computes ((srclen * 3) / 4) without overflow. */
-        PRUint32 rem = srclen % 4;
-        PRUint32 destlen = (srclen / 4) * 3 + (rem * 3) / 4;
+        PRUint32 destlen = (srclen / 4) * 3 + ((srclen % 4) * 3) / 4;
         dest = (char *)PR_MALLOC(destlen + 1);
         if( (char *)0 == dest )
         {
             return (char *)0;
         }
         dest[ destlen ] = (char)0; /* null terminate */
         allocated = PR_TRUE;
     }
--- a/nsprpub/lib/libc/src/strlen.c
+++ b/nsprpub/lib/libc/src/strlen.c
@@ -48,17 +48,20 @@ PL_strlen(const char *str)
     if( (const char *)0 == str ) return 0;
 
     l = strlen(str);
 
     /* error checking in case we have a 64-bit platform -- make sure
      * we don't have ultra long strings that overflow an int32
      */ 
     if( sizeof(PRUint32) < sizeof(size_t) )
-        PR_ASSERT(l <= PR_INT32_MAX);
+    {
+        if( l > PR_INT32_MAX )
+            PR_Assert("l <= PR_INT32_MAX", __FILE__, __LINE__);
+    }
 
     return (PRUint32)l;
 }
 
 PR_IMPLEMENT(PRUint32)
 PL_strnlen(const char *str, PRUint32 max)
 {
     register const char *s;
--- a/nsprpub/pr/include/md/_symbian.cfg
+++ b/nsprpub/pr/include/md/_symbian.cfg
@@ -82,23 +82,63 @@
 #define PR_BITS_PER_WORD_LOG2   5
 
 #define PR_ALIGN_OF_SHORT   2
 #define PR_ALIGN_OF_INT     4
 #define PR_ALIGN_OF_LONG    4
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_POINTER 4
 #define PR_ALIGN_OF_WORD    4
-#ifdef __WINS__
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_DOUBLE  8
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#elif defined(__WINS__)
+
+#define IS_LITTLE_ENDIAN 1
+#undef  IS_BIG_ENDIAN
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   4
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   4
+#define PR_BYTES_PER_DWORD  8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    32
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    32
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   5
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   5
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
 #define PR_ALIGN_OF_INT64   4
 #define PR_ALIGN_OF_DOUBLE  4
-#else
-#define PR_ALIGN_OF_INT64   8
-#define PR_ALIGN_OF_DOUBLE  8
-#endif
 
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
 #else
 
 #error "Unknown CPU architecture"
 
--- a/nsprpub/pr/include/md/_symbian.h
+++ b/nsprpub/pr/include/md/_symbian.h
@@ -40,17 +40,19 @@
 
 #include "prthread.h"
 
 /*
  * Internal configuration macros
  */
 
 #define _PR_SI_SYSNAME  "SYMBIAN"
-#ifdef __arm__
+#if defined(__WINS__)
+#define _PR_SI_ARCHITECTURE "i386"
+#elif defined(__arm__)
 #define _PR_SI_ARCHITECTURE "arm"
 #else
 #error "Unknown CPU architecture"
 #endif
 #define PR_DLL_SUFFIX		".dll"
 
 #undef	HAVE_STACK_GROWING_UP
 
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -58,21 +58,21 @@ PR_BEGIN_EXTERN_C
 /*
 ** NSPR's version is used to determine the likelihood that the version you
 ** used to build your component is anywhere close to being compatible with
 ** what is in the underlying library.
 **
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.8"
+#define PR_VERSION  "4.8.1 Beta"
 #define PR_VMAJOR   4
 #define PR_VMINOR   8
-#define PR_VPATCH   0
-#define PR_BETA     PR_FALSE
+#define PR_VPATCH   1
+#define PR_BETA     PR_TRUE
 
 /*
 ** PRVersionCheck
 **
 ** The basic signature of the function that is called to provide version
 ** checking. The result will be a boolean that indicates the likelihood
 ** that the underling library will perform as the caller expects.
 **
--- a/nsprpub/pr/src/md/windows/ntmisc.c
+++ b/nsprpub/pr/src/md/windows/ntmisc.c
@@ -835,16 +835,25 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo
 					(void)PR_snprintf(name, namelen, "Windows_98");
 				else
 					(void)PR_snprintf(name, namelen, "Windows_95");
 			} else if (PR_SI_RELEASE == cmd) {
 				(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, 
             							osvi.dwMinorVersion);
 			}
 			break;
+#ifdef VER_PLATFORM_WIN32_CE
+    case VER_PLATFORM_WIN32_CE:
+			if (PR_SI_SYSNAME == cmd)
+				(void)PR_snprintf(name, namelen, "Windows_CE");
+			else if (PR_SI_RELEASE == cmd)
+				(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, 
+            							osvi.dwMinorVersion);
+			break;
+#endif
    		default:
 			if (PR_SI_SYSNAME == cmd)
 				(void)PR_snprintf(name, namelen, "Windows_Unknown");
 			else if (PR_SI_RELEASE == cmd)
 				(void)PR_snprintf(name, namelen, "%d.%d",0,0);
 			break;
 	}
 	return PR_SUCCESS;
--- a/nsprpub/pr/src/misc/prtrace.c
+++ b/nsprpub/pr/src/misc/prtrace.c
@@ -511,17 +511,17 @@ PR_IMPLEMENT(void)
             PR_LOG( lm, PR_LOG_DEBUG,
                 ("PRSetTraceOption: PRTraceLockTraceHandles"));
             PR_Lock( traceLock );
             break;
         
         case PRTraceUnLockHandles :
             PR_LOG( lm, PR_LOG_DEBUG,
                 ("PRSetTraceOption: PRTraceUnLockHandles"));
-            PR_Lock( traceLock );
+            PR_Unlock( traceLock );
             break;
 
         default:
             PR_LOG( lm, PR_LOG_ERROR,
                 ("PRSetTraceOption: Invalid command %ld", command ));
             PR_ASSERT( 0 );
             break;
     } /* end switch() */
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -47,28 +47,29 @@
  */
 
 #include "prinit.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 /*
- * This release (4.8) is backward compatible with the
- * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, and
- * 4.7.x releases.  It, of course, is compatible with
+ * This release (4.8.1) is backward compatible with the
+ * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
+ * and 4.8 releases.  It, of course, is compatible with
  * itself.
  */
 static char *compatible_version[] = {
     "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
     "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1",
     "4.5", "4.5.1",
     "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5",
     "4.6.6", "4.6.7", "4.6.8",
-    "4.7", "4.7.1", "4.7.2", "4.7.3", PR_VERSION
+    "4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4",
+    "4.8", PR_VERSION
 };
 
 /*
  * This release is not backward compatible with the old
  * NSPR 2.1 and 3.x releases.
  *
  * Any release is incompatible with future releases and
  * patches.