We're updating the issue view to help you get more done. 

OOM not handled in DecimalFormat::touch when creating LocalizedNumberFormatter

Description

While trying to find a local workaround for to avoid Firefox crashes <https://bugzilla.mozilla.org/show_bug.cgi?id=1495244>, another currently not handled OOM failure was detected in DecimalFormat::touch when creating the LocalizedNumberFormatter, cf. <https://github.com/unicode-org/icu/blob/1f7d8ababef429b45596bb38b685544cfba78cd7/icu4c/source/i18n/decimfmt.cpp#L1150-L1154>:

1 2 3 4 5 fields->formatter.adoptInstead( new LocalizedNumberFormatter( NumberPropertyMapper::create( *fields->properties, *fields->symbols, fields->warehouse, *fields->exportedProperties, status).locale( locale)));

If new LocalizedNumberFormatter returns nullptr on OOM, fields->formatter is in an invalid state, so any operation on it will fail.

Detecting and properly handling this case is currently not possible in all cases, because not all users of fields->formatter have a UErrorCode present to propagate allocation failures, for example DecimalFormat::toNumberFormatter() will end up dereferencing a nullptr.

Status

Assignee

Jeff Genovy

Reporter

André Bargull

Labels

Reviewer

None

Time Needed

None

Start date

None

Components

Fix versions

Priority

TBD