Author: shenhanc78 <shenhan(a)google.com>
Date: 2018-01-17 (Wed, 17 Jan 2018)
FIX properly handle corner case. (#10450)
There is one test case that fails undefined behavior test. This happens
when n is 0, which resutls in log(n) evalutes to -inf. And to convert
-inf to integer is undefined behavior and causes exception when
undefined behavior check is turned on.
Properly handle this by early return when sorting array is zero length.
I agree this might be an usage error instead of a bug, but to leave it
vulnerable to undefined behavior exception might not a good idea.
Undefined behavior check is happy after this fix.