• Kailasnath Nagarkar's avatar
    Bug #24489302 : ZEROFILL CAUSE MEMORY-CORRUPTION AND CRASH · 91ddaff9
    Kailasnath Nagarkar authored
    ISSUE: Heap corruption occurs and hence mysql server
           terminates abnormally in String variable destructor
           when ZEROFILL is used for a column.
           Though the abnormal termination is observed in the
           String destructor, heap corruption occurs at earlier
           stage when function Field_num::prepend_zeros() is called.
           This function, prepends zeros to the actual data and
           works on entire field length. Since the allocated memory
           could be less than the field length, heap corruption occurs.
           Later, when String destructor tries to free heap, the server
           terminates abnormally since the heap is corrupt.
    
    
    
    SOLUTION: In Field_num::prepend_zeros() function, if allocated memory
              is less than the field length, re-allocate memory enough to
              hold field length size data.
    91ddaff9
field.cc 285 KB