Skip to content
Snippets Groups Projects
Commit 8a701fbf authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

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.
parent 45cae0f5
No related branches found
No related tags found
1 merge request!114External tests
...@@ -31,11 +31,11 @@ typedef struct ffpoly_struct ...@@ -31,11 +31,11 @@ typedef struct ffpoly_struct
t_float x_f; t_float x_f;
t_outlet *x_outlet; t_outlet *x_outlet;
t_int *x_coef; int *x_coef;
t_int x_poly_order; int x_poly_order;
t_int x_field_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) ...@@ -49,7 +49,7 @@ static void ffpoly_compute(t_ffpoly *x, t_floatarg fcoef)
int in = (int)fcoef; int in = (int)fcoef;
int fo = x->x_field_order; int fo = x->x_field_order;
int po = x->x_poly_order; int po = x->x_poly_order;
t_int* c = x->x_coef; int* c = x->x_coef;
int i, out; int i, out;
in %= fo; in %= fo;
...@@ -124,8 +124,8 @@ t_class *ffpoly_class; ...@@ -124,8 +124,8 @@ t_class *ffpoly_class;
static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder) static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder)
{ {
t_int polyorder = (int)fpolyorder; int polyorder = (int)fpolyorder;
t_int fieldorder = (int)ffieldorder; int fieldorder = (int)ffieldorder;
t_ffpoly *x = (t_ffpoly *)pd_new(ffpoly_class); t_ffpoly *x = (t_ffpoly *)pd_new(ffpoly_class);
...@@ -135,7 +135,7 @@ static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder) ...@@ -135,7 +135,7 @@ static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder)
x->x_poly_order = polyorder; x->x_poly_order = polyorder;
x->x_field_order = fieldorder; 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 */ /* set poly to f(x) = x */
ffpoly_coefficients(x, x->x_field_order); ffpoly_coefficients(x, x->x_field_order);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment