• unknown's avatar
    Bug#27079 Crash while grouping empty ucs2 strings · 916245f9
    unknown authored
    Problem: GROUP BY on empty ucs2 strings crashed server.
    Reason: sometimes mi_unique_hash() is executed with
    ptr=null and length=0, which means "empty string".
    The branch of code handling UCS2 character set
    was not safe against ptr=null and fell into and
    endless loop even if length=0 because of poiter
    arithmetic overflow.
    Fix: adding special check for length=0 to avoid pointer arithmetic
    overflow.
    
    
    mysql-test/r/ctype_uca.result:
      Adding test case
    mysql-test/t/ctype_uca.test:
      Adding test case
    strings/ctype-uca.c:
      Fix my_uca_scanner_init_ucs2 to be safe against
      strings with length=0 and ptr=0.
    916245f9
ctype-uca.c 452 KB