[Libreoffice-commits] core.git: external/icu
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 29 06:43:21 UTC 2019
external/icu/UnpackedTarball_icu.mk | 1 +
external/icu/ubsan.patch | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
New commits:
commit 78fbbc77d0e3318c6490470f8050a5b1e3cae28d
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 28 16:43:23 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 29 07:42:31 2019 +0100
external/icu: Fix UBSan nullptr-with-nonzero-offset
...(new with Clang 10 trunk), as seen during ExternalProject_icu:
> rbutil.c:49:67: runtime error: applying non-zero offset 1 to null pointer
> #0 in get_basename at workdir/UnpackedTarball/icu/source/tools/genrb/rbutil.c:49:67
> #1 in make_res_filename(char const*, char const*, char const*, UErrorCode&) at workdir/UnpackedTarball/icu/source/tools/genrb/genrb.cpp:768:5
> #2 in processFile(char const*, char const*, char const*, char const*, char const*, SRBRoot*, signed char, UErrorCode&) at workdir/UnpackedTarball/icu/source/tools/genrb/genrb.cpp:695:14
> #3 in main at workdir/UnpackedTarball/icu/source/tools/genrb/genrb.cpp:527:9
> rbutil.c:54:67: runtime error: applying non-zero offset 1 to null pointer
> #0 in get_basename at workdir/UnpackedTarball/icu/source/tools/genrb/rbutil.c:54:67
> #1 in make_res_filename(char const*, char const*, char const*, UErrorCode&) at workdir/UnpackedTarball/icu/source/tools/genrb/genrb.cpp:768:5
> #2 in processFile(char const*, char const*, char const*, char const*, char const*, SRBRoot*, signed char, UErrorCode&) at workdir/UnpackedTarball/icu/source/tools/genrb/genrb.cpp:695:14
> #3 in main at workdir/UnpackedTarball/icu/source/tools/genrb/genrb.cpp:527:9
(uprv_strrchr appears to be plain strrchr, see
workdir/UnpackedTarball/icu/source/common/cstring.h, so returns null for "not
found", and in both of the fixed places, the following
if(lastSlash>filename)
was apparently meant to filter out cases where uprv_strrchr returned null.)
Change-Id: I32b3a72955d33d73fa4295cf5f91a69fd270efeb
Reviewed-on: https://gerrit.libreoffice.org/81613
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 4e23ba2686be..388b7305bc2d 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
external/icu/char8_t.patch \
external/icu/c++20-comparison.patch \
external/icu/icu4c-64-54558d1dd01b29c763ca12b6327108fe3ac66637.patch.2 \
+ external/icu/ubsan.patch \
))
$(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
diff --git a/external/icu/ubsan.patch b/external/icu/ubsan.patch
new file mode 100644
index 000000000000..9acae66465d4
--- /dev/null
+++ b/external/icu/ubsan.patch
@@ -0,0 +1,30 @@
+--- 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) {
More information about the Libreoffice-commits
mailing list