Skip to content

Commit

Permalink
Update NSPR to the NSPR_HEAD_20090801 CVS tag.
Browse files Browse the repository at this point in the history
- Change version from 4.8 to 4.8.1 Beta
- Fix bug 492779, bug 501864, bug 504379, bug 505889, bug 507506
  • Loading branch information
wantehchang committed Aug 7, 2009
1 parent c0eddba commit bfdb6bd
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 48 deletions.
8 changes: 4 additions & 4 deletions nsprpub/admin/repackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions nsprpub/config/prdepend.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@
*/

#error "Do not include this header file."

47 changes: 24 additions & 23 deletions nsprpub/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -4232,6 +4232,7 @@ EOF
DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV
fi
_DEBUG_FLAGS=-Zi
_OPTIMIZE_FLAGS=-O2
;;

*-ncr-sysv*)
Expand Down Expand Up @@ -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
#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*
Expand Down Expand Up @@ -5164,15 +5165,15 @@ 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
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
Expand All @@ -5183,7 +5184,7 @@ 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
Expand All @@ -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
#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*
Expand Down Expand Up @@ -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 <<EOF
#line 5253 "configure"
#line 5254 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
Expand All @@ -5267,7 +5268,7 @@ 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
Expand All @@ -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 <<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. */
Expand All @@ -5319,7 +5320,7 @@ $ac_func();
; 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 <pthread.h>
void *foo(void *v) { return v; }
Expand All @@ -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 <pthread.h>
void *foo(void *v) { return v; }
Expand All @@ -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 <pthread.h>
void *foo(void *v) { return v; }
Expand All @@ -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 <pthread.h>
void *foo(void *v) { return v; }
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion nsprpub/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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*)
Expand Down
10 changes: 10 additions & 0 deletions nsprpub/lib/libc/include/plbase64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand All @@ -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 *)
Expand Down
22 changes: 17 additions & 5 deletions nsprpub/lib/libc/src/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string.h> /* for strlen */

static unsigned char *base = (unsigned char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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)) )
Expand All @@ -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 )
{
Expand Down
5 changes: 4 additions & 1 deletion nsprpub/lib/libc/src/strlen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
50 changes: 45 additions & 5 deletions nsprpub/pr/include/md/_symbian.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion nsprpub/pr/include/md/_symbian.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit bfdb6bd

Please sign in to comment.