summary refs log tree commit diff
path: root/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
blob: 58ac66bd55110536c6b84310858bb5b308f8f5d6 (plain) (blame)
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
From 629600450b3845a768c0edc92ea3f444d03a2738 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Tue, 20 May 2014 01:37:58 -0700
Subject: [PATCH 12/13] glapi: Avoid heap corruption in _glapi_table

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Chia-I Wu <olv@lunarg.com>
(cherry picked from commit ff5456d1acf6f627a6837be3f3f37c6a268c9e8e)
---
 src/mapi/glapi/gen/gl_gentable.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
index 5657e32..0d0a02d 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -111,7 +111,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
 
 struct _glapi_table *
 _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
-    struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
+    struct _glapi_table *disp = calloc(1, _glapi_get_dispatch_table_size() * sizeof(_glapi_proc));
     char symboln[512];
 
     if(!disp)
-- 
1.9.2