From 2bf4c0ce5b8f1bc71bc1d680b6ab2d614248e072 Mon Sep 17 00:00:00 2001 From: Manohar Paluri Date: Thu, 18 Feb 2010 22:52:49 +0000 Subject: [PATCH] Fixed two bugs, both related to array overflow --- cpp/projectiveGeometry.cpp | 4 ++-- cpp/svdcmp.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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;