After chatting with Monty, we came to the conclusion that there is not much of a need for enforcing a limit on the column alias length. Thus, we removed the check that the length is less than MAX_ALIAS_LENGTH in Item::set_name.
We also removed all references to MAX_ALIAS_NAME in the code. It was only used as fixed-length buffer in a few utility functions as a temporary place for performing lower-case operations. We replaced these lower-case operations with the transform operations and used std::string's instead of fixed-length buffers.
Thus, we were able to resolve this bug by actually removing some code :)