Commit 20c4f790 authored by Sean McBride's avatar Sean McBride Committed by Kitware Robot
Browse files

Merge topic 'UB-hash'

769fe2cf

 Fixed undefined signed int overflow in hash function
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: David Gobbi's avatarDavid Gobbi <david.gobbi@gmail.com>
Merge-request: !3253
parents 6a35cf0e 769fe2cf
......@@ -374,7 +374,7 @@ vtkTableBasedClipperEdgeHashTable::~vtkTableBasedClipperEdgeHashTable()
int vtkTableBasedClipperEdgeHashTable::GetKey( int p1, int p2 )
{
int rv = ( ( p1 * 18457 + p2 * 234749 ) % nHashes );
int rv = ( int )( ( unsigned int )p1 * 18457U + ( unsigned int )p2 * 234749U ) % nHashes;
// In case of overflows and modulo with negative numbers.
if ( rv < 0 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment