зеркало из https://github.com/mozilla/pjs.git
Bug 170379: fix the stack overflow crash by not allocating the 32K "sieve"
array on the stack.
This commit is contained in:
Родитель
5aa713accb
Коммит
d87339b635
|
@ -428,7 +428,8 @@ mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong,
|
|||
* Mac builds don't break by adding an extra variable
|
||||
* on the stack. -javi
|
||||
*/
|
||||
#if defined(macintosh) || defined (XP_OS2)
|
||||
#if defined(macintosh) || defined (XP_OS2) \
|
||||
|| (defined(HPUX) && defined(__ia64))
|
||||
unsigned char *sieve;
|
||||
|
||||
sieve = malloc(SIEVE_SIZE);
|
||||
|
@ -570,7 +571,8 @@ CLEANUP:
|
|||
mp_clear(&q);
|
||||
if (nTries)
|
||||
*nTries += i;
|
||||
#if defined(macintosh) || defined(XP_OS2)
|
||||
#if defined(macintosh) || defined(XP_OS2) \
|
||||
|| (defined(HPUX) && defined(__ia64))
|
||||
if (sieve != NULL) {
|
||||
memset(sieve, 0, SIEVE_SIZE);
|
||||
free (sieve);
|
||||
|
|
Загрузка…
Ссылка в новой задаче