UPRV_UNREACHABLE called in code that is easily reachable, crashes production code

Description

UPRV_UNREACHABLE, which now unconditionally calls abort(), is called in u_UCharsToChars() if that function is passed a non-invariant character:

This used to call U_ASSERT which is a no-op in production code:

This UPRV_UNREACHABLE can easily be reached not only by direct calls to u_UCharsToChars (in which case there is at least API documentation that says that it is not intended for non-invariant chars) but indirectly, e.g. via a call to ucal_getTimeZoneIDForWindowsID() that is passed a (presumably malformed) Windows zoneID containing non-invariant chars.

This is rather bad.

Activity

Show:
Peter Edberg
June 25, 2019, 6:14 PM
Edited

Just hit another one of these in i18n/usearch.cpp:

This is crashing production code on our platforms.

Peter Edberg
June 26, 2019, 5:08 PM

Per TC dicussion: Will use this fix for a PR against master that just reverts the specific change in u_UCharsToChars(); that may go into a maintenance branch. File another ticket for a broader investigation of use of UPRV_UNREACHABLE, including the CEIBuffer::get[Previous] issue in the comment above.

Jeff Genovy
June 26, 2019, 5:10 PM
Edited

Thank you Peter!

Peter Edberg
August 28, 2019, 5:19 AM

Filed for the follow-on issue

Fixed

Assignee

Peter Edberg

Reporter

Peter Edberg

Components

Labels

Reviewer

None

Priority

critical

Time Needed

Hours

Fix versions

Configure