diff options
Diffstat (limited to '')
-rw-r--r-- | external/icu/ubsan.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/external/icu/ubsan.patch b/external/icu/ubsan.patch new file mode 100644 index 000000000..762bd6e5a --- /dev/null +++ b/external/icu/ubsan.patch @@ -0,0 +1,52 @@ +--- source/common/uloc.cpp ++++ source/common/uloc.cpp +@@ -1203,7 +1203,8 @@ + return 0; + } + int32_t reslen = result.length(); +- uprv_memcpy(language, result.data(), std::min(reslen, languageCapacity)); ++ auto const n = std::min(reslen, languageCapacity); ++ if (n != 0) uprv_memcpy(language, result.data(), n); + return reslen; + } + +@@ -1251,7 +1252,8 @@ + return 0; + } + int32_t reslen = result.length(); +- uprv_memcpy(script, result.data(), std::min(reslen, scriptCapacity)); ++ auto const n = std::min(reslen, scriptCapacity); ++ if (n != 0) uprv_memcpy(script, result.data(), n); + return reslen; + } + +--- source/tools/genrb/rbutil.c ++++ source/tools/genrb/rbutil.c +@@ -30,7 +30,12 @@ + get_dirname(char *dirname, + const char *filename) + { +- const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR) + 1; ++ const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR); ++ if(lastSlash == NULL) { ++ lastSlash = filename; ++ } else { ++ ++lastSlash; ++ } + + if(lastSlash>filename) { + uprv_strncpy(dirname, filename, (lastSlash - filename)); +@@ -46,7 +51,12 @@ + const char *filename) + { + /* strip off any leading directory portions */ +- const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR) + 1; ++ const char *lastSlash = uprv_strrchr(filename, U_FILE_SEP_CHAR); ++ if(lastSlash == NULL) { ++ lastSlash = filename; ++ } else { ++ ++lastSlash; ++ } + char *lastDot; + + if(lastSlash>filename) { |