mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0030550: Coding - Integer overflow in Standard_CString HashCodes
0030551: Foundation Classes - Integer overflow in NCollection_CellFilter HashCode Signed integers are not used in hash code functions now to prevent undefined behavior on left shift operations with signed integers. A possibility of negative values of hash codes is eliminated. INT_MAX → IntegerLast() in hash code functions. All found hash code functions behaves uniformly now: they return a value in the range [1, theUpperBound]. Relevant comments are added to such functions.
This commit is contained in:
@@ -144,9 +144,10 @@ Standard_Boolean OSD_Thread::Run (const Standard_Address data,
|
||||
adata->func = myFunc;
|
||||
|
||||
// then try to create a new thread
|
||||
|
||||
DWORD aThreadId = DWORD();
|
||||
myThread = CreateThread ( NULL, WNTStackSize, WNTthread_func,
|
||||
adata, 0, &myThreadId );
|
||||
adata, 0, &aThreadId );
|
||||
myThreadId = aThreadId;
|
||||
if ( myThread )
|
||||
SetThreadPriority (myThread, myPriority);
|
||||
else {
|
||||
@@ -162,7 +163,7 @@ Standard_Boolean OSD_Thread::Run (const Standard_Address data,
|
||||
}
|
||||
else
|
||||
{
|
||||
myThreadId = myThread;
|
||||
myThreadId = (Standard_ThreadId)myThread;
|
||||
}
|
||||
#endif
|
||||
return myThread != 0;
|
||||
@@ -328,6 +329,6 @@ Standard_ThreadId OSD_Thread::Current ()
|
||||
#ifdef _WIN32
|
||||
return GetCurrentThreadId();
|
||||
#else
|
||||
return pthread_self();
|
||||
return (Standard_ThreadId)pthread_self();
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user