File magics-fix-vector-access.patch of Package Magics
--- a/src/visualisers/IsoPlot.cc.orig 2022-09-06 10:31:54.138514887 +0200
+++ a/src/visualisers/IsoPlot.cc 2022-09-06 10:33:02.516228835 +0200
@@ -1677,7 +1677,7 @@
double missing = data.missing();
- int i = 0;
+ auto i = points_.begin();
MagLog::dev() << "min = " << data.min() << " max = " << data.max() << endl;
for (vector<std::pair<double, double> >::iterator xy = xypoints.begin(); xy != xypoints.end(); ++xy) {
@@ -1701,7 +1701,7 @@
else {
// cout << "MISSING VALUE-->" << geo->second << ", " << geo->first << endl;
}
- points_[i] = value;
+ points_.insert(i, value);
i++;
++geo;
}
--- a/src/decoders/GribRegularInterpretor.cc.orig 2022-09-26 14:45:59.835350557 +0200
+++ a/src/decoders/GribRegularInterpretor.cc 2022-09-26 14:48:54.808490952 +0200
@@ -1546,6 +1546,7 @@
else // otherwise, just copy the array of values as they are
{
if (v != NULL) {
+ v->resize(aux);
grib_get_double_array(grib.uHandle(), "values", &u->front(), &aux);
grib_get_double_array(grib.uHandle(), "values", &u->data_.front(), &aux);
grib_get_double_array(grib.vHandle(), "values", &v->front(), &aux);
--- a/src/decoders/GribRegularInterpretor.cc.orig 2022-09-27 08:36:22.875734037 +0200
+++ a/src/decoders/GribRegularInterpretor.cc 2022-09-27 08:36:45.993673168 +0200
@@ -581,6 +581,7 @@
else // otherwise, just copy the array of values as they are
{
if (v != NULL) {
+ v->resize(nb);
grib_get_double_array(grib.uHandle(), "values", &u->front(), &aux);
grib_get_double_array(grib.uHandle(), "values", &u->data_.front(), &aux);
grib_get_double_array(grib.vHandle(), "values", &v->front(), &aux);
--- a/src/decoders/GribRegularInterpretor.cc.orig 2023-06-12 15:38:16.650383212 +0200
+++ a/src/decoders/GribRegularInterpretor.cc 2023-06-12 16:14:43.667315748 +0200
@@ -566,6 +566,7 @@
if (jPointsAreConsecutive) {
vector<double>* d = new vector<double>(nb); // temporary array
+ d->resize(nb);
double* d1 = &d->front(); // temporary array pointer
double* d2 = &u->front(); // final array
@@ -587,6 +588,7 @@
grib_get_double_array(grib.vHandle(), "values", &v->data_.front(), &aux);
if (c) {
c->data_.resize(nb);
+ c->resize(nb);
grib_get_double_array(grib.cHandle(), "values", &c->front(), &aux);
grib_get_double_array(grib.cHandle(), "values", &c->data_.front(), &aux);
}