Cherrypick ICU PR3420 to fix error condition of heap buffer overflow

https://patch-diff.githubusercontent.com/raw/unicode-org/icu/pull/3420.diff

We found some additional issues on the ICU and fixed that on
https://github.com/unicode-org/icu/pull/3420

Bug: 393989622
Change-Id: I047c4a3e8c851281bf034cc79ea92ae6e897bb10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/6310736
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: David Yeung <dayeung@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
4 files changed