mirror of https://github.com/xzeldon/htop.git
Fix out-of-bounds read
Detected by Coverity: https://scan8.coverity.com/reports.htm#v13252/p10402/fileInstanceId=22093847&defectInstanceId=7543344&mergedDefectId=174181
This commit is contained in:
parent
f4f35da7e0
commit
ff78a1bfce
2
Meter.c
2
Meter.c
|
@ -404,7 +404,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
k = -i/2;
|
k = -i/2;
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
for (; i < nValues; i+=2, k++) {
|
for (; i < nValues - 1; i+=2, k++) {
|
||||||
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
||||||
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
||||||
int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
|
int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
|
||||||
|
|
Loading…
Reference in New Issue