aboutsummaryrefslogtreecommitdiffstats
path: root/main/libxfont2/libXfont-2.0.1-misc-fixes.patch
blob: 92cf92facf6d8ad3fb65691dcb3d52f0c3d6f186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
From eefc0b0b908eb8533e704d7156ce983ad7891cc5 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Sat, 12 Dec 2015 14:54:26 -0800
Subject: [PATCH libXfont 1/9] Revert "Add compiler warning flags". Leave
 warning fixes.

This reverts commit eb67d10ae82b364a4324e96ce53baaa4e5e75f97, but
leaves the warning fixes in place; it looks like either I was
confused, or something has changed so that XORG_DEFAULT_OPTIONS now
pulls in the appropriate compiler warnings.
---
 configure.ac     |  24 -----
 m4/attributes.m4 | 283 -------------------------------------------------------
 2 files changed, 307 deletions(-)
 delete mode 100644 m4/attributes.m4

diff --git a/configure.ac b/configure.ac
index a555151..13c8c97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,6 @@ AC_INIT([libXfont2], [2.0.1],
 	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont2])
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_MACRO_DIR([m4])
 
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
@@ -58,27 +57,6 @@ AC_CHECK_FUNCS([poll readlink])
 # must first be located explicitly.
 PKG_PROG_PKG_CONFIG
 
-with_cflags=""
-if test "x$GCC" = "xyes"; then
-	CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-				-Wall \
-				-Wextra \
-				-Wno-sign-compare \
-				-Wno-missing-field-initializers \
-				-Wno-unused-parameter \
-				-Wstrict-prototypes \
-				-Wmissing-prototypes \
-				-fvisibility=hidden \
-				-pipe \
-				-fno-strict-aliasing \
-				-ffunction-sections \
-				-fdata-sections \
-				-fno-strict-aliasing \
-				-fdiagnostics-show-option \
-				-fno-common])
-fi
-AC_SUBST([GCC_CFLAGS], $with_cflags)
-
 #
 # select libraries to include
 #
@@ -239,8 +217,6 @@ case $host_os in
         OS_CFLAGS=
         ;;
 esac
-OS_CFLAGS="$OS_CFLAGS $GCC_CFLAGS"
-
 AC_SUBST([OS_CFLAGS])
 
 AC_CONFIG_FILES([Makefile
diff --git a/m4/attributes.m4 b/m4/attributes.m4
deleted file mode 100644
index 5fbd43d..0000000
--- a/m4/attributes.m4
+++ /dev/null
@@ -1,283 +0,0 @@
-dnl Macros to check the presence of generic (non-typed) symbols.
-dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
-dnl Copyright (c) 2006-2008 xine project
-dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2, or (at your option)
-dnl any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-dnl 02110-1301, USA.
-dnl
-dnl As a special exception, the copyright owners of the
-dnl macro gives unlimited permission to copy, distribute and modify the
-dnl configure scripts that are the output of Autoconf when processing the
-dnl Macro. You need not follow the terms of the GNU General Public
-dnl License when using or distributing such scripts, even though portions
-dnl of the text of the Macro appear in them. The GNU General Public
-dnl License (GPL) does govern all other use of the material that
-dnl constitutes the Autoconf Macro.
-dnl
-dnl This special exception to the GPL applies to versions of the
-dnl Autoconf Macro released by this project. When you make and
-dnl distribute a modified version of the Autoconf Macro, you may extend
-dnl this special exception to the GPL to apply to your modified version as
-dnl well.
-
-dnl Check if FLAG in ENV-VAR is supported by compiler and append it
-dnl to WHERE-TO-APPEND variable
-dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
-
-AC_DEFUN([CC_CHECK_FLAG_APPEND], [
-  AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
-                 AS_TR_SH([cc_cv_$2_$3]),
-          [eval "AS_TR_SH([cc_save_$2])='${$2}'"
-           eval "AS_TR_SH([$2])='-Werror $3'"
-           AC_LINK_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])],
-                          [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
-                          [eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
-           eval "AS_TR_SH([$2])='$cc_save_$2'"])
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
-        [eval "$1='${$1} $3'"])
-])
-
-dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
-AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
-  for flag in $3; do
-    CC_CHECK_FLAG_APPEND($1, $2, $flag)
-  done
-])
-
-dnl Check if the flag is supported by linker (cacheable)
-dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
-
-AC_DEFUN([CC_CHECK_LDFLAGS], [
-  AC_CACHE_CHECK([if $CC supports $1 flag],
-    AS_TR_SH([cc_cv_ldflags_$1]),
-    [ac_save_LDFLAGS="$LDFLAGS"
-     LDFLAGS="$LDFLAGS $1"
-     AC_LINK_IFELSE([int main() { return 1; }],
-       [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
-       [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
-     LDFLAGS="$ac_save_LDFLAGS"
-    ])
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
-    [$2], [$3])
-])
-
-dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
-dnl the current linker to avoid undefined references in a shared object.
-AC_DEFUN([CC_NOUNDEFINED], [
-  dnl We check $host for which systems to enable this for.
-  AC_REQUIRE([AC_CANONICAL_HOST])
-
-  case $host in
-     dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads
-     dnl are requested, as different implementations are present; to avoid problems
-     dnl use -Wl,-z,defs only for those platform not behaving this way.
-     *-freebsd* | *-openbsd*) ;;
-     *)
-        dnl First of all check for the --no-undefined variant of GNU ld. This allows
-        dnl for a much more readable commandline, so that people can understand what
-        dnl it does without going to look for what the heck -z defs does.
-        for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
-           CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
-           break
-        done
-     ;;
-  esac
-
-  AC_SUBST([LDFLAGS_NOUNDEFINED])
-])
-
-dnl Check for a -Werror flag or equivalent. -Werror is the GCC
-dnl and ICC flag that tells the compiler to treat all the warnings
-dnl as fatal. We usually need this option to make sure that some
-dnl constructs (like attributes) are not simply ignored.
-dnl
-dnl Other compilers don't support -Werror per se, but they support
-dnl an equivalent flag:
-dnl  - Sun Studio compiler supports -errwarn=%all
-dnl we don't test for that, it gives us false positives when gcc doesn't
-dnl actually complain about it. If someone wants to compile this on sun, let
-dnl them fix it.
-AC_DEFUN([CC_CHECK_WERROR], [
-  AC_CACHE_CHECK(
-    [for $CC way to treat warnings as errors],
-    [cc_cv_werror],
-    [CC_CHECK_FLAG_APPEND([cc_cv_werror], [CFLAGS], [-Werror])])
-])
-
-AC_DEFUN([CC_CHECK_ATTRIBUTE], [
-  AC_REQUIRE([CC_CHECK_WERROR])
-  AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
-    AS_TR_SH([cc_cv_attribute_$1]),
-    [ac_save_CFLAGS="$CFLAGS"
-     CFLAGS="$CFLAGS $cc_cv_werror"
-     AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
-       [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
-       [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
-     CFLAGS="$ac_save_CFLAGS"
-    ])
-
-  AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
-    [AC_DEFINE(
-       AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
-         [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
-         )
-     $4],
-    [$5])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
-  CC_CHECK_ATTRIBUTE(
-    [constructor],,
-    [void __attribute__((constructor)) ctor() { int a; }],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
-  CC_CHECK_ATTRIBUTE(
-    [format], [format(printf, n, n)],
-    [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
-  CC_CHECK_ATTRIBUTE(
-    [format_arg], [format_arg(printf)],
-    [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
-  CC_CHECK_ATTRIBUTE(
-    [visibility_$1], [visibility("$1")],
-    [void __attribute__((visibility("$1"))) $1_function() { }],
-    [$2], [$3])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
-  CC_CHECK_ATTRIBUTE(
-    [nonnull], [nonnull()],
-    [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
-  CC_CHECK_ATTRIBUTE(
-    [unused], ,
-    [void some_function(void *foo, __attribute__((unused)) void *bar);],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
-  CC_CHECK_ATTRIBUTE(
-    [sentinel], ,
-    [void some_function(void *foo, ...) __attribute__((sentinel));],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
-  CC_CHECK_ATTRIBUTE(
-    [deprecated], ,
-    [void some_function(void *foo, ...) __attribute__((deprecated));],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
-  CC_CHECK_ATTRIBUTE(
-    [alias], [weak, alias],
-    [void other_function(void *foo) { }
-     void some_function(void *foo) __attribute__((weak, alias("other_function")));],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
-  CC_CHECK_ATTRIBUTE(
-    [malloc], ,
-    [void * __attribute__((malloc)) my_alloc(int n);],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_PACKED], [
-  CC_CHECK_ATTRIBUTE(
-    [packed], ,
-    [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_CONST], [
-  CC_CHECK_ATTRIBUTE(
-    [const], ,
-    [int __attribute__((const)) twopow(int n) { return 1 << n; } ],
-    [$1], [$2])
-])
-
-AC_DEFUN([CC_FLAG_VISIBILITY], [
-  AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
-    [cc_cv_flag_visibility],
-    [CC_CHECK_FLAG_APPEND([cc_cv_flag_visibility], [CFLAGS], [-fvisibility=hidden])])
-
-  AS_IF([test "x$cc_cv_flag_visibility" != "x"],
-    [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
-       [Define this if the compiler supports the -fvisibility flag])
-     $1],
-    [$2])
-])
-
-AC_DEFUN([CC_FUNC_EXPECT], [
-  AC_REQUIRE([CC_CHECK_WERROR])
-  AC_CACHE_CHECK([if compiler has __builtin_expect function],
-    [cc_cv_func_expect],
-    [ac_save_CFLAGS="$CFLAGS"
-     CFLAGS="$CFLAGS $cc_cv_werror"
-     AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-       [int some_function() {
-        int a = 3;
-        return (int)__builtin_expect(a, 3);
-     }])],
-       [cc_cv_func_expect=yes],
-       [cc_cv_func_expect=no])
-     CFLAGS="$ac_save_CFLAGS"
-    ])
-
-  AS_IF([test "x$cc_cv_func_expect" = "xyes"],
-    [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
-     [Define this if the compiler supports __builtin_expect() function])
-     $1],
-    [$2])
-])
-
-AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
-  AC_REQUIRE([CC_CHECK_WERROR])
-  AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported],
-    [cc_cv_attribute_aligned],
-    [ac_save_CFLAGS="$CFLAGS"
-     CFLAGS="$CFLAGS $cc_cv_werror"
-     for cc_attribute_align_try in 64 32 16 8 4 2; do
-        AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-          int main() {
-            static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
-            return c;
-          }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
-     done
-     CFLAGS="$ac_save_CFLAGS"
-  ])
-
-  if test "x$cc_cv_attribute_aligned" != "x"; then
-     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned],
-       [Define the highest alignment supported])
-  fi
-])
-- 
2.9.3

From d0fff111992fed9d9bfbf0c19e136bda9ba1db55 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sun, 29 May 2016 23:29:50 -0700
Subject: [PATCH libXfont 2/9] FreeType: Correct an allocation size

Found by clang static analysis:
    Result of 'calloc' is converted to a pointer of type 'int', which is
    incompatible with sizeof operand type 'int *'

This is likely benign because the old size was larger on any platform where
sizeof(int) <= sizeof(void *), which is everywhere.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 src/FreeType/ftfuncs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index bbd4db4..e7c8026 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -623,7 +623,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance,
     offset = idx - segment * FONTSEGMENTSIZE;
 
     if((*available)[segment] == NULL) {
-        (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int *));
+        (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int));
         if((*available)[segment] == NULL)
             return AllocError;
     }
-- 
2.9.3

From ac559fad20bbae45332c758abb6a790c3fd341a2 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sun, 29 May 2016 23:34:35 -0700
Subject: [PATCH libXfont 3/9] bitmap: Bail out on invalid input to
 FontFileMakeDir instead of calling calloc for 0 bytes

Found by clang static analysis:
    Call to 'calloc' has an allocation size of 0 bytes

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 src/bitmap/bitscale.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
index 22747a9..00adcc6 100644
--- a/src/bitmap/bitscale.c
+++ b/src/bitmap/bitscale.c
@@ -1477,6 +1477,10 @@ BitmapScaleBitmaps(FontPtr pf,          /* scaled font */
     lastRow = pfi->lastRow;
 
     nchars = (lastRow - firstRow + 1) * (lastCol - firstCol + 1);
+    if (nchars <= 0) {
+        goto bail;
+    }
+
     glyph = pf->glyph;
     for (i = 0; i < nchars; i++)
     {
-- 
2.9.3

From e6009adbc89ec3e1f924bcb57b333c1c02f5e66d Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sun, 29 May 2016 23:37:13 -0700
Subject: [PATCH libXfont 4/9] fserve: Silence a -Wformat warning

src/fc/fserve.c:653:32: warning: format specifies type 'int' but the argument has type 'CARD32' (aka 'unsigned long') [-Wformat]
               " from font server\n", rep->length);
                                      ^~~~~~~~~~~
1 warning generated.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 src/fc/fserve.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/fc/fserve.c b/src/fc/fserve.c
index 42c4028..fb1941d 100644
--- a/src/fc/fserve.c
+++ b/src/fc/fserve.c
@@ -649,8 +649,8 @@ fs_get_reply (FSFpePtr conn, int *error)
      */
     if (rep->length > MAX_REPLY_LENGTH)
     {
-	ErrorF("fserve: reply length %d > MAX_REPLY_LENGTH, disconnecting"
-	       " from font server\n", rep->length);
+	ErrorF("fserve: reply length %ld > MAX_REPLY_LENGTH, disconnecting"
+	       " from font server\n", (long)rep->length);
 	_fs_connection_died (conn);
 	*error = FSIO_ERROR;
 	return 0;
-- 
2.9.3

From d967caa988eaabd9e84c82879e2f21bd33b952a7 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sun, 29 May 2016 23:39:06 -0700
Subject: [PATCH libXfont 5/9] fstrans: Remove unused foo() function

The point of it seems to have been to silence an unused function warning, but
there's no point if we're just transitioning that to another unused function
warning.

src/fc/fstrans.c:32:20: warning: unused function 'foo' [-Wunused-function]
static inline void foo(void) { (void) is_numeric("a"); }
                   ^
1 warning generated.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
 src/fc/fstrans.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/fc/fstrans.c b/src/fc/fstrans.c
index 66bc978..902ef36 100644
--- a/src/fc/fstrans.c
+++ b/src/fc/fstrans.c
@@ -28,5 +28,3 @@
 #define FONT_t
 #define TRANS_CLIENT
 #include <X11/Xtrans/transport.c>
-/* inhibit warning about is_numeric */
-static inline void foo(void) { (void) is_numeric("a"); }
-- 
2.9.3

From 6972ea08ee5b2ef1cfbdc2fcaf14f06bbd391561 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Mon, 30 May 2016 00:46:21 -0700
Subject: [PATCH libXfont 6/9] fserve: Fix a buffer read overrun in
 _fs_client_access

https://bugs.freedesktop.org/show_bug.cgi?id=83224

Found by clang's Address Sanitizer

	crac.num_auths = set_font_authorizations(&authorizations, &authlen,
						 client);
	/* Work around bug in xfs versions up through modular release 1.0.8
	   which rejects CreateAC packets with num_auths = 0 & authlen < 4 */
	if (crac.num_auths == 0) {
	    authorizations = padding;
	    authlen = 4;
	} else {
	    authlen = (authlen + 3) & ~0x3;
	}
	crac.length = (sizeof (fsCreateACReq) + authlen) >> 2;
	crac.acid = cur->acid;
	_fs_add_req_log(conn, FS_CreateAC);
	_fs_write(conn, (char *) &crac, sizeof (fsCreateACReq));
	_fs_write(conn, authorizations, authlen);

In the case in the report, set_font_authorizations setup authorizations as a
34 byte buffer (and authlen set to 34 as one would expect). The following
block changed authlen to 36 to make it 4byte aligned and the final _fs_write()
caused us to read 36 bytes from this 34 byte buffer.

This changes the incorrect size increase to instead use _fs_write_pad which
takes care of the padding for us.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 src/fc/fserve.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/fc/fserve.c b/src/fc/fserve.c
index fb1941d..708fc35 100644
--- a/src/fc/fserve.c
+++ b/src/fc/fserve.c
@@ -2856,14 +2856,12 @@ _fs_client_access (FSFpePtr conn, pointer client, Bool sync)
 	if (crac.num_auths == 0) {
 	    authorizations = padding;
 	    authlen = 4;
-	} else {
-	    authlen = (authlen + 3) & ~0x3;
 	}
 	crac.length = (sizeof (fsCreateACReq) + authlen) >> 2;
 	crac.acid = cur->acid;
 	_fs_add_req_log(conn, FS_CreateAC);
 	_fs_write(conn, (char *) &crac, sizeof (fsCreateACReq));
-	_fs_write(conn, authorizations, authlen);
+	_fs_write_pad(conn, authorizations, authlen);
 	/* ignore reply; we don't even care about it */
 	conn->curacid = 0;
 	cur->auth_generation = client_auth_generation(client);
-- 
2.9.3

From 7557fe152d9948bcb4b805bb7b6b6f8121bd34fb Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 18 May 2016 11:52:27 -0400
Subject: [PATCH libXfont 7/9] configure: Use -fvisibility=hidden if available

text	   data	    bss	    dec	    hex	filename
 233732	   8168	   1616	 243516	  3b73c	.libs/libXfont2.so.2.before
 217113	   6816	   1616	 225545	  37109	.libs/libXfont2.so.2.after

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 configure.ac | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/configure.ac b/configure.ac
index 13c8c97..062f75d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,23 @@ case $host_os in
         OS_CFLAGS=
         ;;
 esac
+
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fvisibility=hidden"
+CFLAGS_VISIBILITY=
+AC_COMPILE_IFELSE(
+  [AC_LANG_SOURCE([[
+    #if defined(__CYGWIN__) || defined(__MINGW32__)
+    #error No visibility support
+    #endif
+    extern __attribute__((__visibility__("default"))) int x;
+  ]])],
+  [CFLAGS_VISIBILITY=-fvisibility=hidden],
+  []
+)
+CFLAGS="$save_CFLAGS"
+OS_CFLAGS="$OS_CFLAGS $CFLAGS_VISIBILITY"
+
 AC_SUBST([OS_CFLAGS])
 
 AC_CONFIG_FILES([Makefile
-- 
2.9.3

From 33a98f2b5343da927f29191348e992f505544873 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Wed, 8 Jun 2016 14:28:09 -0400
Subject: [PATCH libXfont 9/9] freetype: Fix a logic error in computing face
 name

gcc6 chirps an indentation warning here, but really this is bad code.
Effectively this would ignore en_US or en_UK names for the font, despite
that those are the English names the font is most likely to have.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
---
 src/FreeType/fttools.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/FreeType/fttools.c b/src/FreeType/fttools.c
index 7c0bd9b..0329fae 100644
--- a/src/FreeType/fttools.c
+++ b/src/FreeType/fttools.c
@@ -100,7 +100,6 @@ FTGetName(FT_Face face, int nid, int pid, int eid, FT_SfntName *name_return)
             case TT_PLATFORM_MICROSOFT:
                 if(name.language_id != TT_MS_LANGID_ENGLISH_UNITED_STATES &&
                    name.language_id != TT_MS_LANGID_ENGLISH_UNITED_KINGDOM)
-                    break;
                     continue;
                 break;
             default:
-- 
2.9.3