Core/Shared: Add thread-safe access to BigNumber::AsByteArray()
fixes #5469
This commit is contained in:
@@ -169,6 +169,8 @@ uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
|
|||||||
{
|
{
|
||||||
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
|
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
|
||||||
|
|
||||||
|
ACE_GUARD_RETURN(ACE_Mutex, g, _lock, 0);
|
||||||
|
|
||||||
if (_array)
|
if (_array)
|
||||||
{
|
{
|
||||||
delete[] _array;
|
delete[] _array;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#define _AUTH_BIGNUMBER_H
|
#define _AUTH_BIGNUMBER_H
|
||||||
|
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
|
#include <ace/Mutex.h>
|
||||||
|
|
||||||
struct bignum_st;
|
struct bignum_st;
|
||||||
|
|
||||||
@@ -89,6 +90,10 @@ class BigNumber
|
|||||||
private:
|
private:
|
||||||
struct bignum_st *_bn;
|
struct bignum_st *_bn;
|
||||||
uint8 *_array;
|
uint8 *_array;
|
||||||
|
|
||||||
|
// This mutex only controls thread-safe access to AsByteArray() and should be replaced with a thread-safe implementation of BigNumber
|
||||||
|
ACE_Mutex _lock;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user