diff --git a/cpp/projectiveGeometry.cpp b/cpp/projectiveGeometry.cpp index 6ace33fb9..dfbb2f95a 100644 --- a/cpp/projectiveGeometry.cpp +++ b/cpp/projectiveGeometry.cpp @@ -43,7 +43,7 @@ namespace gtsam { /* ************************************************************************* */ Point3h point3h(double X, double Y, double Z, double W) { - double data[3]; + double data[4]; data[0] = X; data[1] = Y; data[2] = Z; @@ -53,7 +53,7 @@ namespace gtsam { /* ************************************************************************* */ Plane3h plane3h(double a, double b, double c, double d) { - double data[3]; + double data[4]; data[0] = a; data[1] = b; data[2] = c; diff --git a/cpp/svdcmp.cpp b/cpp/svdcmp.cpp index 618bc5232..22f3a2ef9 100644 --- a/cpp/svdcmp.cpp +++ b/cpp/svdcmp.cpp @@ -264,8 +264,8 @@ void svdcmp(double **a, int m, int n, double w[], double **v, bool sort) { } if (sort) { - int *indices1 = new int[n]; - int *indices2 = new int[n]; + int *indices1 = new int[n+1]; + int *indices2 = new int[n+1]; for (int i1 = 1; i1 <= n; i1++) { indices1[i1] = i1; indices2[i1] = i1;