summaryrefslogtreecommitdiff
path: root/sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch
reinit the tree, so we can have metadata
Diffstat (limited to 'sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch')
-rw-r--r--sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch b/sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch
new file mode 100644
index 000000000000..9f7271860229
--- /dev/null
+++ b/sci-biology/mosaik/files/mosaik-2.2.30-Wformat-security.patch
@@ -0,0 +1,84 @@
+- Fix incorrect printf format specifier (-Wformat)
+* fann.c: In function ‘fann_print_connections’:
+* fann.c:889:11: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
+* printf("L %3d / N %4d %s\n", layer_it - ann->first_layer,
+
+- Fix erroneous memset call
+* md5.c: In function ‘MD5Final’:
+* md5.c:152:26: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
+* memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+
+--- a/fann-2.1.0/fann.c
++++ b/fann-2.1.0/fann.c
+@@ -886,7 +886,7 @@
+ neurons[ann->connections[i] - ann->first_layer->first_neuron] = (char)('A' + value);
+ }
+ }
+- printf("L %3d / N %4d %s\n", layer_it - ann->first_layer,
++ printf("L %3ld / N %4ld %s\n", layer_it - ann->first_layer,
+ neuron_it - ann->first_layer->first_neuron, neurons);
+ }
+ }
+@@ -987,12 +987,12 @@
+ {
+ if(ann->network_type == FANN_NETTYPE_SHORTCUT)
+ {
+- printf(" Hidden layer :%4d neurons, 0 bias\n",
++ printf(" Hidden layer :%4ld neurons, 0 bias\n",
+ layer_it->last_neuron - layer_it->first_neuron);
+ }
+ else
+ {
+- printf(" Hidden layer :%4d neurons, 1 bias\n",
++ printf(" Hidden layer :%4ld neurons, 1 bias\n",
+ layer_it->last_neuron - layer_it->first_neuron - 1);
+ }
+ }
+--- a/fann-2.1.0/fann_io.c
++++ b/fann-2.1.0/fann_io.c
+@@ -174,7 +174,7 @@
+ #endif
+
+ /* Save network parameters */
+- fprintf(conf, "num_layers=%u\n", ann->last_layer - ann->first_layer);
++ fprintf(conf, "num_layers=%ld\n", ann->last_layer - ann->first_layer);
+ fprintf(conf, "learning_rate=%f\n", ann->learning_rate);
+ fprintf(conf, "connection_rate=%f\n", ann->connection_rate);
+ fprintf(conf, "network_type=%u\n", ann->network_type);
+@@ -236,7 +236,7 @@
+ for(layer_it = ann->first_layer; layer_it != ann->last_layer; layer_it++)
+ {
+ /* the number of neurons in the layers (in the last layer, there is always one too many neurons, because of an unused bias) */
+- fprintf(conf, "%u ", layer_it->last_neuron - layer_it->first_neuron);
++ fprintf(conf, "%ld ", layer_it->last_neuron - layer_it->first_neuron);
+ }
+ fprintf(conf, "\n");
+
+@@ -316,14 +316,14 @@
+ if(save_as_fixed)
+ {
+ /* save the connection "(source weight) " */
+- fprintf(conf, "(%u, %d) ",
++ fprintf(conf, "(%ld, %d) ",
+ connected_neurons[i] - first_neuron,
+ (int) floor((weights[i] * fixed_multiplier) + 0.5));
+ }
+ else
+ {
+ /* save the connection "(source weight) " */
+- fprintf(conf, "(%u, " FANNPRINTF ") ", connected_neurons[i] - first_neuron, weights[i]);
++ fprintf(conf, "(%ld, " FANNPRINTF ") ", connected_neurons[i] - first_neuron, weights[i]);
+ }
+ #else
+ /* save the connection "(source weight) " */
+--- a/CommonSource/Utilities/md5.c
++++ b/CommonSource/Utilities/md5.c
+@@ -149,7 +149,7 @@
+ MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ byteReverse((unsigned char *) ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
++ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
+ }
+
+