SHA256
1
0
forked from pool/transfig
transfig/transfig-fix-afl.patch

51 lines
2.1 KiB
Diff
Raw Normal View History

Index: transfig.3.2.5e/fig2dev/read1_3.c
===================================================================
--- transfig.3.2.5e.orig/fig2dev/read1_3.c
+++ transfig.3.2.5e/fig2dev/read1_3.c
@@ -336,6 +336,7 @@ FILE *fp;
l->back_arrow = NULL;
l->next = NULL;
l->points = Point_malloc(p);
+ l->points->next = NULL;
n = fscanf(fp, " %d %d %d %lf %d %d %d %d %d %d", &t,
&l->style, &l->thickness, &l->style_val,
&f, &b, &h, &w, &p->x, &p->y);
@@ -395,6 +396,7 @@ FILE *fp;
s->controls = NULL;
s->next = NULL;
s->points = Point_malloc(p);
+ s->points->next = NULL;
n = fscanf(fp, " %d %d %d %lf %d %d %d %d %d %d",
&t, &s->style, &s->thickness, &s->style_val,
&f, &b,
Index: transfig.3.2.5e/fig2dev/alloc.h
===================================================================
--- transfig.3.2.5e.orig/fig2dev/alloc.h
+++ transfig.3.2.5e/fig2dev/alloc.h
@@ -13,15 +13,15 @@
* notice remain intact.
*/
-#define Line_malloc(z) z = (F_line*)malloc(LINOBJ_SIZE)
-#define Pic_malloc(z) z = (F_pic*)malloc(PIC_SIZE)
-#define Spline_malloc(z) z = (F_spline*)malloc(SPLOBJ_SIZE)
-#define Ellipse_malloc(z) z = (F_ellipse*)malloc(ELLOBJ_SIZE)
-#define Arc_malloc(z) z = (F_arc*)malloc(ARCOBJ_SIZE)
-#define Compound_malloc(z) z = (F_compound*)malloc(COMOBJ_SIZE)
-#define Text_malloc(z) z = (F_text*)malloc(TEXOBJ_SIZE)
-#define Point_malloc(z) z = (F_point*)malloc(POINT_SIZE)
-#define Control_malloc(z) z = (F_control*)malloc(CONTROL_SIZE)
-#define Arrow_malloc(z) z = (F_arrow*)malloc(ARROW_SIZE)
+#define Line_malloc(z) z = (F_line*)calloc(LINOBJ_SIZE,1)
+#define Pic_malloc(z) z = (F_pic*)calloc(PIC_SIZE,1)
+#define Spline_malloc(z) z = (F_spline*)calloc(SPLOBJ_SIZE,1)
+#define Ellipse_malloc(z) z = (F_ellipse*)calloc(ELLOBJ_SIZE,1)
+#define Arc_malloc(z) z = (F_arc*)calloc(ARCOBJ_SIZE,1)
+#define Compound_malloc(z) z = (F_compound*)calloc(COMOBJ_SIZE,1)
+#define Text_malloc(z) z = (F_text*)calloc(TEXOBJ_SIZE,1)
+#define Point_malloc(z) z = (F_point*)calloc(POINT_SIZE,1)
+#define Control_malloc(z) z = (F_control*)calloc(CONTROL_SIZE,1)
+#define Arrow_malloc(z) z = (F_arrow*)calloc(ARROW_SIZE,1)
extern char Err_mem[];