From ff78a1bfcea625aa19beea1747cd797efad90991 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sun, 18 Feb 2018 10:17:56 -0300 Subject: [PATCH] Fix out-of-bounds read Detected by Coverity: https://scan8.coverity.com/reports.htm#v13252/p10402/fileInstanceId=22093847&defectInstanceId=7543344&mergedDefectId=174181 --- Meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meter.c b/Meter.c index 0d561e41..05a4eb23 100644 --- a/Meter.c +++ b/Meter.c @@ -404,7 +404,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { k = -i/2; i = 0; } - for (; i < nValues; i+=2, k++) { + for (; i < nValues - 1; i+=2, k++) { int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT; int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix); int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);