summaryrefslogtreecommitdiff
path: root/package/bison/patches
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2018-02-25 10:10:22 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-02-26 20:17:37 +0000
commita3179dbb28fdd37e1be5b7a2c2c2f3e4cad88de8 (patch)
tree56769c7c43fec57514bbe7e9351a8c8cf99eed35 /package/bison/patches
parent3b7272d7dd160830323aaf1cac5f15506258ba04 (diff)
bison: fix Mac High Sierra issue
Diffstat (limited to 'package/bison/patches')
-rw-r--r--package/bison/patches/patch-lib_vasnprintf_c28
1 files changed, 28 insertions, 0 deletions
diff --git a/package/bison/patches/patch-lib_vasnprintf_c b/package/bison/patches/patch-lib_vasnprintf_c
new file mode 100644
index 000000000..cb21d90fa
--- /dev/null
+++ b/package/bison/patches/patch-lib_vasnprintf_c
@@ -0,0 +1,28 @@
+--- bison-3.0.4.orig/lib/vasnprintf.c 2015-01-04 17:46:03.000000000 +0100
++++ bison-3.0.4/lib/vasnprintf.c 2018-02-24 21:13:43.000000000 +0100
+@@ -4858,7 +4858,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
+ #endif
+ *fbp = dp->conversion;
+ #if USE_SNPRINTF
+-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
++# if ! (((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \
++ && !defined __UCLIBC__) \
++ || (defined __APPLE__ && defined __MACH__) \
++ || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+ fbp[1] = '%';
+ fbp[2] = 'n';
+ fbp[3] = '\0';
+@@ -4872,6 +4875,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
+ in format strings in writable memory may crash the program
+ (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
+ in this situation. */
++ /* On Mac OS X 10.3 or newer, we know that snprintf's return
++ value conforms to ISO C 99: the tests gl_SNPRINTF_RETVAL_C99
++ and gl_SNPRINTF_TRUNCATION_C99 pass.
++ Therefore we can avoid using %n in this situation.
++ On Mac OS X 10.13 or newer, the use of %n in format strings
++ in writable memory by default crashes the program, so we
++ should avoid it in this situation. */
+ /* On native Windows systems (such as mingw), we can avoid using
+ %n because:
+ - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,