diff --git a/nsprpub/admin/repackage.sh b/nsprpub/admin/repackage.sh index 7bbfa58d61af9..0df32218288a0 100755 --- a/nsprpub/admin/repackage.sh +++ b/nsprpub/admin/repackage.sh @@ -64,10 +64,10 @@ # # ------------------------------------------------------------------ -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 diff --git a/nsprpub/config/prdepend.h b/nsprpub/config/prdepend.h index df72c56882d21..55444c40b3aa8 100644 --- a/nsprpub/config/prdepend.h +++ b/nsprpub/config/prdepend.h @@ -42,3 +42,4 @@ */ #error "Do not include this header file." + diff --git a/nsprpub/configure b/nsprpub/configure index 542542d886bd7..6c923af51cc8f 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -695,7 +695,7 @@ test "$host_alias" != "$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= @@ -4232,6 +4232,7 @@ EOF DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV fi _DEBUG_FLAGS=-Zi + _OPTIMIZE_FLAGS=-O2 ;; *-ncr-sysv*) @@ -4505,17 +4506,17 @@ EOF _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 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* @@ -5164,7 +5165,7 @@ case $target in ;; *) 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 @@ -5172,7 +5173,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&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 @@ -5200,17 +5201,17 @@ 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 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* @@ -5243,13 +5244,13 @@ 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 < Autoconf TIOCGETP @@ -5267,7 +5268,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -5291,12 +5292,12 @@ 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 <&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 @@ -5360,7 +5361,7 @@ 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 @@ -5399,7 +5400,7 @@ darwin*) *) 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 void *foo(void *v) { return v; } @@ -5421,7 +5422,7 @@ echo " 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 void *foo(void *v) { return v; } @@ -5443,7 +5444,7 @@ echo " 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 void *foo(void *v) { return v; } @@ -5465,7 +5466,7 @@ echo " 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 void *foo(void *v) { return v; } @@ -5597,7 +5598,7 @@ 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 @@ -5620,7 +5621,7 @@ echo "configure:5601: checking whether ${CC-cc} accepts -pthread" >&5 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 diff --git a/nsprpub/configure.in b/nsprpub/configure.in index 50cecd44a9ca7..e6b0d9c06fe5e 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -50,7 +50,7 @@ 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= @@ -1684,6 +1684,7 @@ tools are selected during the Xcode/Developer Tools installation.]) DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV fi _DEBUG_FLAGS=-Zi + _OPTIMIZE_FLAGS=-O2 ;; *-ncr-sysv*) diff --git a/nsprpub/lib/libc/include/plbase64.h b/nsprpub/lib/libc/include/plbase64.h index ac07e83735141..d21ff5d77ec75 100644 --- a/nsprpub/lib/libc/include/plbase64.h +++ b/nsprpub/lib/libc/include/plbase64.h @@ -57,6 +57,10 @@ PR_BEGIN_EXTERN_C * 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 *) @@ -83,6 +87,12 @@ PL_Base64Encode * 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 *) diff --git a/nsprpub/lib/libc/src/base64.c b/nsprpub/lib/libc/src/base64.c index 0f6127574f0b3..e3fd80d7d6186 100644 --- a/nsprpub/lib/libc/src/base64.c +++ b/nsprpub/lib/libc/src/base64.c @@ -38,7 +38,8 @@ #include "plbase64.h" #include "prlog.h" /* For PR_NOT_REACHED */ #include "prmem.h" /* for malloc / PR_MALLOC */ -#include "plstr.h" /* for PL_strlen */ + +#include /* for strlen */ static unsigned char *base = (unsigned char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -150,7 +151,13 @@ PL_Base64Encode { 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 ) @@ -389,7 +396,13 @@ PL_Base64Decode 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)) ) @@ -410,8 +423,7 @@ PL_Base64Decode 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 ) { diff --git a/nsprpub/lib/libc/src/strlen.c b/nsprpub/lib/libc/src/strlen.c index 5cbc2b7ab1d2b..e03f7d25825ae 100644 --- a/nsprpub/lib/libc/src/strlen.c +++ b/nsprpub/lib/libc/src/strlen.c @@ -53,7 +53,10 @@ PL_strlen(const char *str) * 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; } diff --git a/nsprpub/pr/include/md/_symbian.cfg b/nsprpub/pr/include/md/_symbian.cfg index 09a2466984ef6..2db9af7312cff 100644 --- a/nsprpub/pr/include/md/_symbian.cfg +++ b/nsprpub/pr/include/md/_symbian.cfg @@ -87,13 +87,53 @@ #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 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 + +#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 #define PR_BYTES_PER_WORD_LOG2 2 #define PR_BYTES_PER_DWORD_LOG2 3 diff --git a/nsprpub/pr/include/md/_symbian.h b/nsprpub/pr/include/md/_symbian.h index 7393a958ac6f2..1fef115520e0c 100644 --- a/nsprpub/pr/include/md/_symbian.h +++ b/nsprpub/pr/include/md/_symbian.h @@ -45,7 +45,9 @@ */ #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" diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h index 6ce57a81e02a9..57b4c36cf8458 100644 --- a/nsprpub/pr/include/prinit.h +++ b/nsprpub/pr/include/prinit.h @@ -63,11 +63,11 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** ".[.] []" */ -#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 diff --git a/nsprpub/pr/src/md/windows/ntmisc.c b/nsprpub/pr/src/md/windows/ntmisc.c index 289c19bba0c52..ce3c587bd497d 100644 --- a/nsprpub/pr/src/md/windows/ntmisc.c +++ b/nsprpub/pr/src/md/windows/ntmisc.c @@ -840,6 +840,15 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) 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"); diff --git a/nsprpub/pr/src/misc/prtrace.c b/nsprpub/pr/src/misc/prtrace.c index 67208f37ee8b1..762dd82153947 100644 --- a/nsprpub/pr/src/misc/prtrace.c +++ b/nsprpub/pr/src/misc/prtrace.c @@ -516,7 +516,7 @@ PR_IMPLEMENT(void) case PRTraceUnLockHandles : PR_LOG( lm, PR_LOG_DEBUG, ("PRSetTraceOption: PRTraceUnLockHandles")); - PR_Lock( traceLock ); + PR_Unlock( traceLock ); break; default: diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c index 01f312265f268..55010b97d1c5c 100644 --- a/nsprpub/pr/tests/vercheck.c +++ b/nsprpub/pr/tests/vercheck.c @@ -52,9 +52,9 @@ #include /* - * 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[] = { @@ -63,7 +63,8 @@ static char *compatible_version[] = { "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 }; /*