8000 ICU-23112 Add check for avoid underflow in MeasureUnit::getIdentifier by wooffie · Pull Request #3485 · unicode-org/icu · GitHub
[go: up one dir, main page]

Skip to content

ICU-23112 Add check for avoid underflow in MeasureUnit::getIdentifier #3485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ICU-23112 Add check for avoid underflow in MeasureUnit::getIdentifier
  • Loading branch information
wooffie committed Apr 24, 2025
commit 44622e3a3599c5739405d34bcaf984c857c5e375
8 changes: 7 additions & 1 deletion icu4c/source/i18n/measunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,13 @@ const char *MeasureUnit::getSubtype() const {
}

const char *MeasureUnit::getIdentifier() const {
return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()];
if (fImpl){
return fImpl->identifier.data();
} else if (fTypeId < 0 || fSubTypeId < 0) {
return "";
} else {
return gSubTypes[getOffset()];
}
}

bool MeasureUnit::operator==(const UObject& other) const {
Expand Down
0