aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-04-20 08:32:59 -0700
committerGravatar GitHub <noreply@github.com>2017-04-20 08:32:59 -0700
commitd93a8bead39ab112b808a248adb4576e4c9ce766 (patch)
tree5de1664a48572f09aecb2b77b10c4f8113b1ec94
parent547a4717cb8f1ad807019941d2f0ec2835505200 (diff)
parent989aa7f97d91478bfdfd8e66e99e2dabda160e72 (diff)
Merge pull request #10746 from ctiller/ubsan
Ubsan fixes
-rw-r--r--test/core/support/time_test.c29
m---------third_party/zlib0
-rwxr-xr-xtools/run_tests/sanity/check_submodules.sh2
3 files changed, 8 insertions, 23 deletions
diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c
index 4cb36a788c..00d0b76503 100644
--- a/test/core/support/time_test.c
+++ b/test/core/support/time_test.c
@@ -47,32 +47,17 @@ static void to_fp(void *arg, const char *buf, size_t len) {
fwrite(buf, 1, len, (FILE *)arg);
}
-/* Convert gpr_uintmax x to ascii base b (2..16), and write with
- (*writer)(arg, ...), zero padding to "chars" digits). */
-static void u_to_s(uintmax_t x, unsigned base, int chars,
- void (*writer)(void *arg, const char *buf, size_t len),
- void *arg) {
- char buf[64];
- char *p = buf + sizeof(buf);
- do {
- *--p = "0123456789abcdef"[x % base];
- x /= base;
- chars--;
- } while (x != 0 || chars > 0);
- (*writer)(arg, p, (size_t)(buf + sizeof(buf) - p));
-}
-
/* Convert gpr_intmax x to ascii base b (2..16), and write with
(*writer)(arg, ...), zero padding to "chars" digits). */
-static void i_to_s(intmax_t x, unsigned base, int chars,
+static void i_to_s(intmax_t x, int base, int chars,
void (*writer)(void *arg, const char *buf, size_t len),
void *arg) {
- if (x < 0) {
- (*writer)(arg, "-", 1);
- u_to_s((uintmax_t)-x, base, chars - 1, writer, arg);
- } else {
- u_to_s((uintmax_t)x, base, chars, writer, arg);
- }
+ char buf[64];
+ char fmt[32];
+ GPR_ASSERT(base == 16 || base == 10);
+ sprintf(fmt, "%%0%d%s", chars, base == 16 ? PRIxMAX : PRIdMAX);
+ sprintf(buf, fmt, x);
+ (*writer)(arg, buf, strlen(buf));
}
/* Convert ts to ascii, and write with (*writer)(arg, ...). */
diff --git a/third_party/zlib b/third_party/zlib
-Subproject 50893291621658f355bc5b4d450a8d06a563053
+Subproject cacf7f1d4e3d44d871b605da3b647f07d718623
diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh
index c5a0dbbef3..0a9c1cc046 100755
--- a/tools/run_tests/sanity/check_submodules.sh
+++ b/tools/run_tests/sanity/check_submodules.sh
@@ -48,7 +48,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules
ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0)
593e917c176b5bc5aafa57bf9f6030d749d91cd5 third_party/protobuf (v3.1.0-alpha-1-326-g593e917)
bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c third_party/thrift (bcad917)
- 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8)
+ cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11)
7691f773af79bf75a62d1863fd0f13ebf9dc51b1 third_party/cares/cares (1.12.0)
EOF