summaryrefslogtreecommitdiffstats
path: root/src/trace/potrace/curve.cpp
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2015-03-31 10:33:40 +0000
committerJazzyNico <nicoduf@yahoo.fr>2015-03-31 10:33:40 +0000
commit3c458ee86d50bf9e877b62ea5e30ba6d4b09bdae (patch)
tree595cdcde1c625895d649314e05a21a098af33559 /src/trace/potrace/curve.cpp
parentAdd clipping at miter-length to 'arcs' line join. (diff)
downloadinkscape-3c458ee86d50bf9e877b62ea5e30ba6d4b09bdae.tar.gz
inkscape-3c458ee86d50bf9e877b62ea5e30ba6d4b09bdae.zip
Updating Potrace from 1.10 to 1.12, fixing Bug #1438366 (CVE-2013-7437 vulnerability).
Fixed bugs: - https://launchpad.net/bugs/1438366 (bzr r14037)
Diffstat (limited to 'src/trace/potrace/curve.cpp')
-rw-r--r--src/trace/potrace/curve.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/trace/potrace/curve.cpp b/src/trace/potrace/curve.cpp
index d2e32aa7b..e6a9a4721 100644
--- a/src/trace/potrace/curve.cpp
+++ b/src/trace/potrace/curve.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2011 Peter Selinger.
+/* Copyright (C) 2001-2015 Peter Selinger.
This file is part of Potrace. It is free software and it is covered
by the GNU General Public License. See the file COPYING for details. */
@@ -12,8 +12,8 @@
#include "lists.h"
#include "curve.h"
-#define SAFE_MALLOC(var, n, typ) \
- if ((var = (typ *)malloc((n)*sizeof(typ))) == NULL) goto malloc_error
+#define SAFE_CALLOC(var, n, typ) \
+ if ((var = (typ *)calloc(n, sizeof(typ))) == NULL) goto calloc_error
/* ---------------------------------------------------------------------- */
/* allocate and free path objects */
@@ -22,14 +22,14 @@ path_t *path_new(void) {
path_t *p = NULL;
privpath_t *priv = NULL;
- SAFE_MALLOC(p, 1, path_t);
+ SAFE_CALLOC(p, 1, path_t);
memset(p, 0, sizeof(path_t));
- SAFE_MALLOC(priv, 1, privpath_t);
+ SAFE_CALLOC(priv, 1, privpath_t);
memset(priv, 0, sizeof(privpath_t));
p->priv = priv;
return p;
- malloc_error:
+ calloc_error:
free(p);
free(priv);
return NULL;
@@ -81,15 +81,15 @@ typedef dpoint_t dpoint3_t[3];
int privcurve_init(privcurve_t *curve, int n) {
memset(curve, 0, sizeof(privcurve_t));
curve->n = n;
- SAFE_MALLOC(curve->tag, n, int);
- SAFE_MALLOC(curve->c, n, dpoint3_t);
- SAFE_MALLOC(curve->vertex, n, dpoint_t);
- SAFE_MALLOC(curve->alpha, n, double);
- SAFE_MALLOC(curve->alpha0, n, double);
- SAFE_MALLOC(curve->beta, n, double);
+ SAFE_CALLOC(curve->tag, n, int);
+ SAFE_CALLOC(curve->c, n, dpoint3_t);
+ SAFE_CALLOC(curve->vertex, n, dpoint_t);
+ SAFE_CALLOC(curve->alpha, n, double);
+ SAFE_CALLOC(curve->alpha0, n, double);
+ SAFE_CALLOC(curve->beta, n, double);
return 0;
- malloc_error:
+ calloc_error:
free(curve->tag);
free(curve->c);
free(curve->vertex);