Changeset 29081 for main

Show
Ignore:
Timestamp:
29.05.2014 11:22:00 (6 years ago)
Author:
kjdon
Message:

memcpy not safe for copying in overlapping areas, use memmove instead. Thanks to Michael from DL Consulting for debugging this

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/indexers/mgpp/lib/perf_hash.cpp

    r25147 r29081  
    743743  make_trans_func (num, keys); 
    744744 
    745   if (r <= 0) 
     745  if (r <= 0)  
    746746    SEED_RANDOM ((mg_s_long) time ((time_t *) NULL)); 
    747   else 
     747  else  
    748748    SEED_RANDOM (r); 
    749  
     749   
    750750  MAX_M = num + 1; 
    751751 
     
    767767    return (NULL); 
    768768 
    769   memcpy ((void *) g, (const void *) &g[1], n * sizeof (int)); 
     769  // use memmove not memcpy as memory areas are overlapping 
     770  memmove ((void *) g, (const void *) &g[1], n * sizeof (int)); 
    770771 
    771772  phd->MAX_L = MAX_L;