Uploaded image for project: 'ICU'
  1. ICU-20001

number_decimfmtprops.cpp has unaligned static memory

    Details

    • Type: Bug
    • Status: Done (View workflow)
    • Priority: critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 63.1
    • Component/s: build_c
    • Labels:

      Description

      The file has the following code:

        char kRawDefaultProperties[sizeof(DecimalFormatProperties)];
        ...
        void U_CALLCONV initDefaultProperties(UErrorCode&) {
            new(kRawDefaultProperties) DecimalFormatProperties();
        }
      

      We have a report that this causes a crash on ARM. The DecimalFormatProperties is being constructed into an unaligned char array, and the DecimalFormatProperties' MeasureUnit field assigns to an int32_t field in its ctor.

      Possible fix: add alignas as follows:

      alignas(DecimalFormatProperties)
      char kRawDefaultProperties[sizeof(DecimalFormatProperties)];
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                shane Shane Carr
                Reporter:
                shane Shane Carr
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: