Skip to content

Commit 3c88781

Browse files
committed
ICU-23112 Add check for avoid underflow in MeasureUnit::getIdentifier
1 parent 08a0746 commit 3c88781

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

icu4c/source/i18n/measunit.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,9 @@ const char *MeasureUnit::getSubtype() const {
26502650
}
26512651

26522652
const char *MeasureUnit::getIdentifier() const {
2653+
if (fTypeId < 0 || fSubTypeId < 0) {
2654+
return "";
2655+
}
26532656
return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()];
26542657
}
26552658

0 commit comments

Comments
 (0)