From 05255cbae81dd78c5a1e05f6d2311ae44e76160b Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Tue, 10 May 2016 23:15:33 -0400 Subject: [PATCH] Clean up dodgy array dimension Array is in pairs but has a single sentinel, trips up Coverity (CID 147346) and does allow an out-of-bounds write if WX_GL_SAMPLES were ever removed from the array. --- 3d-viewer/common_ogl/cogl_att_list.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/3d-viewer/common_ogl/cogl_att_list.cpp b/3d-viewer/common_ogl/cogl_att_list.cpp index 4254e0aae3..2999e503ce 100644 --- a/3d-viewer/common_ogl/cogl_att_list.cpp +++ b/3d-viewer/common_ogl/cogl_att_list.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Mario Luzeiro - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -51,13 +51,12 @@ const int COGL_ATT_LIST::m_openGL_AttributesList[] = { WX_GL_STENCIL_SIZE, 1, WX_GL_SAMPLE_BUFFERS, 1, // Enable multisampling support (antialiasing). WX_GL_SAMPLES, 0, // Disable AA for the start. - 0 // NULL termination + 0, 0 // NULL termination }; int COGL_ATT_LIST::m_openGL_AttributesList_toUse[ - sizeof( COGL_ATT_LIST::m_openGL_AttributesList ) / - sizeof( COGL_ATT_LIST::m_openGL_AttributesList[0] ) ] = { 0 }; + DIM( COGL_ATT_LIST::m_openGL_AttributesList ) ] = { 0 }; const int *COGL_ATT_LIST::GetAttributesList( bool aUseAntiAliasing )