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

ICU4C: Segmentation fault when attempting to compare valid and invalid DecimalFormat objects.

Description

While looking into ICU-13847, I came across the following issue: Attempting to compare a valid DecimalFormat object with one that is "invalid" results in dangling/nullptr pointers being deferenced. (Which will likely cause a segmentation fault).

Sample code that demonstrates the issue:

1 2 3 4 5 6 7 8 9 10 11 12 13 UErrorCode status = U_INTERNAL_PROGRAM_ERROR; DecimalFormat dfBogus(status); status = U_ZERO_ERROR; DecimalFormat dfGood(status); // Attempting to compare an invalid object with a valid object results in dangling // and/or nullptr pointers being deferenced. This is undefined behavior, and generally // will cause segmentation fault. if (dfGood != dfBogus) { // code never gets here, as the program crashes. }

Environment

Status

Assignee

Jeff Genovy

Reporter

Jeff Genovy

Labels

Reviewer

Shane Carr

Components

Fix versions

Priority

major