summaryrefslogtreecommitdiff
path: root/user/mesa/disk_cache-stack-overflow.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-14 02:22:19 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-14 02:22:56 -0500
commitb1eb50599e4db7eb4501af75cbbfa22007081ea5 (patch)
treec94a34c882cc17adedd781e8c5f34349b2a62416 /user/mesa/disk_cache-stack-overflow.patch
parentb9e85bbdcf38547ef2ca4e5c2a6e6293bbcd2752 (diff)
downloadpackages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.gz
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.bz2
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.tar.xz
packages-b1eb50599e4db7eb4501af75cbbfa22007081ea5.zip
The New Plan
all pkgs needed to bootstrap -> system others -> user
Diffstat (limited to 'user/mesa/disk_cache-stack-overflow.patch')
-rw-r--r--user/mesa/disk_cache-stack-overflow.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/user/mesa/disk_cache-stack-overflow.patch b/user/mesa/disk_cache-stack-overflow.patch
new file mode 100644
index 000000000..3fad95259
--- /dev/null
+++ b/user/mesa/disk_cache-stack-overflow.patch
@@ -0,0 +1,42 @@
+The disk cache code tries to allocate a 256 Kbyte buffer on the stack.
+Since musl only gives 80 Kbyte of stack space per thread, this causes a trap.
+
+--- mesa-17.3.1/src/util/disk_cache.c.old 2017-12-21 11:31:22.000000000 -0600
++++ mesa-17.3.1/src/util/disk_cache.c 2017-12-29 01:17:15.625633901 -0600
+@@ -716,7 +716,7 @@
+ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest,
+ const char *filename)
+ {
+- unsigned char out[BUFSIZE];
++ unsigned char *out;
+
+ /* allocate deflate state */
+ z_stream strm;
+@@ -733,6 +733,11 @@
+ /* compress until end of in_data */
+ size_t compressed_size = 0;
+ int flush;
++
++ out = calloc(1, BUFSIZE);
++ if (out == NULL)
++ return 0;
++
+ do {
+ int remaining = in_data_size - BUFSIZE;
+ flush = remaining > 0 ? Z_NO_FLUSH : Z_FINISH;
+@@ -754,6 +759,7 @@
+ ssize_t written = write_all(dest, out, have);
+ if (written == -1) {
+ (void)deflateEnd(&strm);
++ free(out);
+ return 0;
+ }
+ } while (strm.avail_out == 0);
+@@ -768,6 +774,7 @@
+
+ /* clean up and return */
+ (void)deflateEnd(&strm);
++ free(out);
+ return compressed_size;
+ }
+