[libxml2] Avoid spurious UBSan errors in parser.c
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Avoid spurious UBSan errors in parser.c
- Date: Thu, 1 Jun 2017 13:02:03 +0000 (UTC)
commit 474967241cdcce6d3a2fd356079571eee794ec12
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Wed May 31 16:46:39 2017 +0200
Avoid spurious UBSan errors in parser.c
If available, use a C99 flexible array member to avoid spurious UBSan
errors.
parser.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/parser.c b/parser.c
index fd242aa..7d8da4f 100644
--- a/parser.c
+++ b/parser.c
@@ -1087,7 +1087,12 @@ typedef xmlDefAttrs *xmlDefAttrsPtr;
struct _xmlDefAttrs {
int nbAttrs; /* number of defaulted attributes on that element */
int maxAttrs; /* the size of the array */
- const xmlChar *values[5]; /* array of localname/prefix/values/external */
+#if __STDC_VERSION__ >= 199901L
+ /* Using a C99 flexible array member avoids UBSan errors. */
+ const xmlChar *values[]; /* array of localname/prefix/values/external */
+#else
+ const xmlChar *values[5];
+#endif
};
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]