Page MenuHomeFreeBSD

D28233.id82561.diff
No OneTemporary

D28233.id82561.diff

Index: cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
===================================================================
--- cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
+++ cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
@@ -1205,7 +1205,7 @@
tdp->t_fndef = xcalloc(sizeof (fndef_t));
tdp->t_fndef->fn_ret = tdarr[ctt->ctt_type];
- v = (void *) (dptr + (sizeof (ushort_t) * (vlen - 1)));
+ v = (void *) (dptr + (ptrdiff_t)(sizeof (ushort_t) * (vlen - 1)));
if (vlen > 0 && *(ushort_t *)v == 0)
tdp->t_fndef->fn_vargs = 1;
Index: cddl/contrib/opensolaris/tools/ctf/cvt/hash.c
===================================================================
--- cddl/contrib/opensolaris/tools/ctf/cvt/hash.c
+++ cddl/contrib/opensolaris/tools/ctf/cvt/hash.c
@@ -76,7 +76,7 @@
{
const char *c;
ulong_t g;
- int h = 0;
+ unsigned h = 0;
for (c = name; *c; c++) {
h = (h << 4) + *c;
Index: contrib/elftoolchain/libdwarf/_libdwarf.h
===================================================================
--- contrib/elftoolchain/libdwarf/_libdwarf.h
+++ contrib/elftoolchain/libdwarf/_libdwarf.h
@@ -36,6 +36,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <gelf.h>
#include "dwarf.h"
Index: contrib/elftoolchain/libdwarf/libdwarf_rw.c
===================================================================
--- contrib/elftoolchain/libdwarf/libdwarf_rw.c
+++ contrib/elftoolchain/libdwarf/libdwarf_rw.c
@@ -290,7 +290,7 @@
} while ((b & 0x80) != 0);
if (shift < 64 && (b & 0x40) != 0)
- ret |= (-1 << shift);
+ ret |= (UINT64_MAX << shift);
return (ret);
}
@@ -353,7 +353,7 @@
do {
b = *src++;
- ret |= ((b & 0x7f) << shift);
+ ret |= ((uint64_t)(b & 0x7f) << shift);
(*offsetp)++;
shift += 7;
} while ((b & 0x80) != 0);
Index: usr.bin/sort/Makefile
===================================================================
--- usr.bin/sort/Makefile
+++ usr.bin/sort/Makefile
@@ -3,8 +3,8 @@
.include <src.opts.mk>
PROG= sort
-
SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c
+CSTD= c11
sort.1: sort.1.in
sed ${MAN_SUB} ${.ALLSRC} >${.TARGET}
Index: usr.bin/sort/bwstring.h
===================================================================
--- usr.bin/sort/bwstring.h
+++ usr.bin/sort/bwstring.h
@@ -50,12 +50,26 @@
*/
struct bwstring
{
- size_t len;
- union
- {
- wchar_t wstr[0];
- unsigned char cstr[0];
- } data;
+ /*
+ * FIXME: this is really ugly, but the easiest way to silence UBSAN's
+ * array-bounds warning without changing any of the other code. It's
+ * needed because we can't defined flexible array members inside unions
+ * (unless they are wrapped inside a struct) and UBSAN complains if we
+ * use the [0] workaround.
+ */
+ union {
+ size_t len;
+ union {
+ struct {
+ size_t wlen;
+ wchar_t wstr[];
+ };
+ struct {
+ size_t clen;
+ unsigned char cstr[];
+ };
+ } data;
+ };
};
struct reader_buffer

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 16, 11:39 AM (15 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31600177
Default Alt Text
D28233.id82561.diff (2 KB)

Event Timeline