From 8a701fbf64a71de46ad06bdfa35d4d3e5a03d8f4 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Mon, 21 Aug 2017 21:18:59 -0400
Subject: [PATCH] use int instead of t_int

It appears int and t_int were freely mixed in this external, causing a size
discrepancy that can result in a buffer overflow. Since t_int is supposed to
be function pointer-sized container, it's unclear why that would be used here.
This commit changes all t_int use to int.

If t_int was really meant here for some reason then we can go in the other
direction.
---
 externals/creb/modules/ffpoly.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/externals/creb/modules/ffpoly.c b/externals/creb/modules/ffpoly.c
index 844a96c7b..e70402530 100644
--- a/externals/creb/modules/ffpoly.c
+++ b/externals/creb/modules/ffpoly.c
@@ -31,11 +31,11 @@ typedef struct ffpoly_struct
     t_float x_f;
 
     t_outlet *x_outlet;
-    t_int *x_coef;
-    t_int x_poly_order;
-    t_int x_field_order;
+    int *x_coef;
+    int x_poly_order;
+    int x_field_order;
 
-    t_int x_lastpackedcoef;
+    int x_lastpackedcoef;
 
 
 
@@ -49,7 +49,7 @@ static void ffpoly_compute(t_ffpoly *x, t_floatarg fcoef)
     int in = (int)fcoef;
     int fo = x->x_field_order;
     int po = x->x_poly_order;
-    t_int* c = x->x_coef;
+    int* c = x->x_coef;
     int i, out;
 
     in %= fo;
@@ -124,8 +124,8 @@ t_class *ffpoly_class;
 
 static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder)
 {
-    t_int polyorder = (int)fpolyorder;
-    t_int fieldorder = (int)ffieldorder;
+    int polyorder = (int)fpolyorder;
+    int fieldorder = (int)ffieldorder;
 
     t_ffpoly *x = (t_ffpoly *)pd_new(ffpoly_class);
 
@@ -135,7 +135,7 @@ static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder)
     x->x_poly_order = polyorder;
     x->x_field_order = fieldorder;
 
-    x->x_coef = (t_int *)malloc((x->x_poly_order  + 1) * sizeof(int));
+    x->x_coef = (int *)malloc((x->x_poly_order  + 1) * sizeof(int));
 
     /* set poly to f(x) = x */
     ffpoly_coefficients(x, x->x_field_order);
-- 
GitLab