Collator::createInstance crashes in optimized code if makeInstance fails
General
Other Data
General
Other Data
Description
Collator::createInstance includes this code:
makeInstance either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status).
setAttributesFromKeywords returns immediately if U_FAILURE(status), so in that case it does not actually use *coll.
however the fact that coll is dereferenced, even if not used, allows a C++ compiler to legally optimize the NULL check out of the implementation of delete.
so a makeInstance failure (e.g. from a bad collation keyword such as "ja@collation=private-kana") will cause such optimized code to crash.
Collator::createInstance includes this code:
makeInstance either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status).
setAttributesFromKeywords returns immediately if U_FAILURE(status), so in that case it does not actually use *coll.
however the fact that coll is dereferenced, even if not used, allows a C++ compiler to legally optimize the NULL check out of the implementation of delete.
so a makeInstance failure (e.g. from a bad collation keyword such as "ja@collation=private-kana") will cause such optimized code to crash.
One fix is just to add
before the setAttributesFromKeywords call.