From 0d94884883ab88729bc552cd999af0f8ffe6c215 Mon Sep 17 00:00:00 2001 From: Daniel Dugas Date: Wed, 12 Sep 2018 14:48:39 +0200 Subject: [PATCH] Enforce check to avoid memory corruption --- scanmatcher/scanmatcher.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scanmatcher/scanmatcher.cpp b/scanmatcher/scanmatcher.cpp index 8f2c3ac..d57e96c 100644 --- a/scanmatcher/scanmatcher.cpp +++ b/scanmatcher/scanmatcher.cpp @@ -560,7 +560,11 @@ void ScanMatcher::setLaserParameters /*if (m_laserAngles) delete [] m_laserAngles; */ - assert(beamsLASER_MAXBEAMS) { + cerr << "Number of beams (" << beams << ") is larger than maximum supported value (" << + LASER_MAXBEAMS << ")." << endl; + exit(-1); + } m_laserPose=lpose; m_laserBeams=beams; //m_laserAngles=new double[beams];